mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 08:45:11 +00:00
Fix Quest / Dialog Sync in Single player
This commit is contained in:
1 parent
23d2681753
commit
fd1500b7ed
5 files changed
+8
-16
No files matched your search
@@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.SyncController;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
@@ -88,6 +89,7 @@ public class CmdDialog extends ChMcLogger {
|
||||
)
|
||||
public boolean reload(String args[]){
|
||||
new DialogController().load();
|
||||
SyncController.syncAllDialogs();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import noppes.npcs.Server;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.controllers.SyncController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.QuestData;
|
||||
@@ -170,6 +171,7 @@ public class CmdQuest extends ChMcLogger{
|
||||
)
|
||||
public boolean reload(String args[]){
|
||||
new QuestController().load();
|
||||
SyncController.syncAllQuests();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,15 +32,4 @@ public class Utils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// <editor-fold desc="--- Foxz fork (pls keep it)">
|
||||
// static public void savePlayerAltInv(EntityPlayer p,String n){
|
||||
// NBTTagList tag=p.inventory.writeToNBT(new NBTTagList());
|
||||
// p.getEntityData().setTag("AltInv_"+n, tag);
|
||||
// }
|
||||
//
|
||||
// static public void loadPlayerAltInv(EntityPlayer p,String n){
|
||||
// p.inventory.readFromNBT((NBTTagList) p.getEntityData().getTag("AltInv_"+n));
|
||||
// }
|
||||
// </editor-fold>
|
||||
}
|
||||
@@ -286,12 +286,12 @@ public class DialogController implements IDialogHandler {
|
||||
File file2 = new File(dir, dialog.id + ".json");
|
||||
|
||||
try {
|
||||
NBTTagCompound compound = dialog.writeToNBT(new NBTTagCompound());
|
||||
NBTTagCompound compound = dialog.writeToNBTPartial(new NBTTagCompound());
|
||||
NBTJsonUtil.SaveFile(file, compound);
|
||||
if(file2.exists())
|
||||
file2.delete();
|
||||
file.renameTo(file2);
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.DIALOG, compound, category.id);
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.DIALOG, dialog.writeToNBT(new NBTTagCompound()), category.id);
|
||||
} catch (Exception e) {
|
||||
LogWriter.except(e);
|
||||
}
|
||||
|
||||
@@ -221,12 +221,11 @@ public class QuestController implements IQuestHandler {
|
||||
File file2 = new File(dir, quest.id + ".json");
|
||||
|
||||
try {
|
||||
NBTTagCompound questCompound = quest.writeToNBTPartial(new NBTTagCompound());
|
||||
NBTJsonUtil.SaveFile(file, questCompound);
|
||||
NBTJsonUtil.SaveFile(file, quest.writeToNBTPartial(new NBTTagCompound()));
|
||||
if(file2.exists())
|
||||
file2.delete();
|
||||
file.renameTo(file2);
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.QUEST, questCompound, category.id);
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.QUEST, quest.writeToNBT(new NBTTagCompound()), category.id);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user