mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 11:05:12 +00:00
Properly save PlayerData on json only on 'PlayerEvent.SaveToFile'
This commit is contained in:
1 parent
2c82714f9a
commit
79e20b07db
10 files changed
+57
-35
No files matched your search
@@ -49,12 +49,20 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
public boolean isGUIOpen = false;
|
||||
|
||||
@Override
|
||||
public void saveNBTData(NBTTagCompound compound) {
|
||||
public void saveNBTData(NBTTagCompound nbtTagCompound) {
|
||||
//Do Nothing
|
||||
}
|
||||
|
||||
public void savePlayerDataOnFile() {
|
||||
PlayerDataController.instance.savePlayerData(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadNBTData(NBTTagCompound compound) {
|
||||
//Do Nothing
|
||||
}
|
||||
|
||||
public void loadPlayerDataFromFile() {
|
||||
NBTTagCompound data = PlayerDataController.instance.loadPlayerData(player.getPersistentID().toString());
|
||||
if(data.hasNoTags()){
|
||||
data = PlayerDataController.instance.loadPlayerDataOld(player.getCommandSenderName());
|
||||
@@ -130,11 +138,11 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
|
||||
public void setGUIOpen(boolean bool) {
|
||||
isGUIOpen = bool;
|
||||
saveNBTData(null);
|
||||
savePlayerDataOnFile();
|
||||
}
|
||||
|
||||
public boolean getGUIOpen() {
|
||||
loadNBTData(null);
|
||||
loadPlayerDataFromFile();
|
||||
return isGUIOpen;
|
||||
}
|
||||
|
||||
@@ -149,7 +157,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
activeCompanion = npc;
|
||||
if(npc != null)
|
||||
((RoleCompanion)npc.roleInterface).companionID = companionID;
|
||||
saveNBTData(null);
|
||||
savePlayerDataOnFile();
|
||||
}
|
||||
|
||||
public void updateCompanion(World world) {
|
||||
|
||||
Reference in new issue
Block a user