Packet Handling

This commit is contained in:
KAMKEEL committed 2023-01-10 17:17:15 -05:00
1 parent 4c2f033a04
commit 974bf2ca66
2 files changed
+38 -25

No files matched your search

@@ -347,6 +347,9 @@ public class PacketHandlerServer{
else if(type == EnumPacketServer.FactionsGet){
NoppesUtilServer.sendFactionDataAll(player);
}
else if(type == EnumPacketServer.TagsGet){
NoppesUtilServer.sendTagDataAll(player);
}
else if(type == EnumPacketServer.DialogGet){
Dialog dialog = DialogController.instance.dialogs.get(buffer.readInt());
if(dialog != null){
@@ -372,6 +375,12 @@ public class PacketHandlerServer{
faction.writeNBT(compound);
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
}
else if(type == EnumPacketServer.TagGet){
NBTTagCompound compound = new NBTTagCompound();
Tag tag = TagController.getInstance().get(buffer.readInt());
tag.writeNBT(compound);
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
}
}
private void wandPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws IOException{
@@ -684,6 +693,25 @@ public class PacketHandlerServer{
(new Faction()).writeNBT(compound);
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
}
else if(type == EnumPacketServer.TagSet){
// npc.setFaction(buffer.readInt());
}
else if(type == EnumPacketServer.TagSave){
Tag tag = new Tag();
tag.readNBT(Server.readNBT(buffer));
TagController.getInstance().saveTag(tag);
NoppesUtilServer.sendTagDataAll(player);
NBTTagCompound compound = new NBTTagCompound();
tag.writeNBT(compound);
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
}
else if(type == EnumPacketServer.TagRemove){
TagController.getInstance().delete(buffer.readInt());
NoppesUtilServer.sendTagDataAll(player);
NBTTagCompound compound = new NBTTagCompound();
(new Tag()).writeNBT(compound);
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
}
else if(type == EnumPacketServer.PlayerDataGet){
int id = buffer.readInt();
if(EnumPlayerData.values().length <= id)