mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 00:47:50 +00:00
Dialog and Quest Saving Bug
This commit is contained in:
1 parent
b2f89035b9
commit
9eadeaa611
2 files changed
+17
No files matched your search
@@ -13,10 +13,13 @@ import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -80,6 +83,13 @@ public final class DialogSavePacket extends AbstractPacket {
|
||||
} else {
|
||||
NoppesUtilServer.sendDialogData((EntityPlayerMP) player, dialog.category);
|
||||
}
|
||||
|
||||
// Send full dialog data back so the client doesn't need a second round-trip
|
||||
NBTTagCompound dialogData = dialog.writeToNBT(new NBTTagCompound());
|
||||
Quest quest = QuestController.Instance.quests.get(dialog.quest);
|
||||
if (quest != null)
|
||||
dialogData.setString("DialogQuestName", quest.title);
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, dialogData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
@@ -79,6 +80,12 @@ public final class QuestSavePacket extends AbstractPacket {
|
||||
} else {
|
||||
NoppesUtilServer.sendQuestData((EntityPlayerMP) player, quest.category);
|
||||
}
|
||||
|
||||
// Send full quest data back so the client doesn't need a second round-trip
|
||||
NBTTagCompound questData = new NBTTagCompound();
|
||||
if (quest.hasNewQuest())
|
||||
questData.setString("NextQuestTitle", quest.getNextQuest().title);
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, quest.writeToNBT(questData));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user