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 3737#include " mc/enums/MinecraftPacketIds.h"
3838#include " mc/enums/ScorePacketType.h"
3939#include " mc/enums/TextPacketType.h"
40+ #include " mc/enums/d_b_helpers/Category.h"
4041#include " mc/nbt/ListTag.h"
4142#include " mc/network/ConnectionRequest.h"
4243#include " mc/network/MinecraftPackets.h"
@@ -369,8 +370,24 @@ Local<Value> McClass::setPlayerNbt(const Arguments& args) {
369370 Player* player = ll::service::getLevel ()->getPlayer (uuid);
370371 if (player) {
371372 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+ }
372389 }
373- return Boolean::newBoolean (true );
390+ return Boolean::newBoolean (false );
374391 }
375392 CATCH (" Fail in setPlayerNbt!" )
376393}
You can’t perform that action at this time.
0 commit comments