File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 37
37
#include " mc/enums/MinecraftPacketIds.h"
38
38
#include " mc/enums/ScorePacketType.h"
39
39
#include " mc/enums/TextPacketType.h"
40
+ #include " mc/enums/d_b_helpers/Category.h"
40
41
#include " mc/nbt/ListTag.h"
41
42
#include " mc/network/ConnectionRequest.h"
42
43
#include " mc/network/MinecraftPackets.h"
@@ -369,8 +370,24 @@ Local<Value> McClass::setPlayerNbt(const Arguments& args) {
369
370
Player* player = ll::service::getLevel ()->getPlayer (uuid);
370
371
if (player) {
371
372
player->load (*tag);
373
+ return Boolean::newBoolean (true );
374
+ } else {
375
+ DBStorage* db = MoreGlobal::db;
376
+ if (db) {
377
+ if (db->hasKey (" player_" + uuid.asString (), DBHelpers::Category::Player)) {
378
+ std::unique_ptr<CompoundTag> playerTag =
379
+ db->getCompoundTag (" player_" + uuid.asString (), DBHelpers::Category::Player);
380
+ if (playerTag) {
381
+ std::string serverId = playerTag->at (" ServerId" );
382
+ if (!serverId.empty ()) {
383
+ db->saveData (serverId, tag->toBinaryNbt (), DBHelpers::Category::Player);
384
+ return Boolean::newBoolean (true );
385
+ }
386
+ }
387
+ }
388
+ }
372
389
}
373
- return Boolean::newBoolean (true );
390
+ return Boolean::newBoolean (false );
374
391
}
375
392
CATCH (" Fail in setPlayerNbt!" )
376
393
}
You can’t perform that action at this time.
0 commit comments