Closed i0xHeX closed 4 years ago
I used this lib to change player location before it logins (AsyncPlayerPreLoginEvent), but looks like it does not save the file properly, even without changes. Simplified sample I tested:
// find file UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + playerName).getBytes(StandardCharsets.UTF_8)); File folderRoot = plugin.getDataFolder().getParentFile().getParentFile(); File folderWorld = new File(folderRoot, "world"); File folderPlayerData = new File(folderWorld, "playerdata"); File filePlayer = new File(folderPlayerData, uuid.toString() + ".dat"); // read & write NamedTag tagFile = NBTUtil.read(filePlayer); CompoundTag tagRoot = (CompoundTag) tagFile.getTag(); NBTUtil.write(tagFile, filePlayer);
And that's how file saved: c0e79713-eb16-3c1f-a9fa-726bd3382b9b.zip
Used version 5.3 from https://jitpack.io/.
P.S. I read location from file earlier, so no problems with file reading.
The NBTSerializer did not flush the data correctly. Use release 5.4 for the fix.
NBTSerializer
I used this lib to change player location before it logins (AsyncPlayerPreLoginEvent), but looks like it does not save the file properly, even without changes. Simplified sample I tested:
And that's how file saved: c0e79713-eb16-3c1f-a9fa-726bd3382b9b.zip
Used version 5.3 from https://jitpack.io/.
P.S. I read location from file earlier, so no problems with file reading.