BUNCH OF NEW PACKETS

This commit is contained in:
Kam committed 2025-02-02 02:25:21 -05:00
1 parent f2c34699b1
commit b22105341f
50 files changed
+620 -392

No files matched your search

@@ -456,142 +456,6 @@ public class PacketHandlerServer{
NoppesUtilServer.setEditingQuest(player,quest);
player.openGui(CustomNpcs.instance, gui , player.worldObj, 0, 0, 0);
}
else if(type == EnumPacketServer.TransportCategoriesGet){
NoppesUtilServer.sendTransportCategoryData(player);
}
else if(type == EnumPacketServer.TransportCategorySave){
TransportController.getInstance().saveCategory(ByteBufUtils.readString(buffer), buffer.readInt());
}
else if(type == EnumPacketServer.TransportCategoryRemove){
TransportController.getInstance().removeCategory(buffer.readInt());
NoppesUtilServer.sendTransportCategoryData(player);
}
else if(type == EnumPacketServer.TransportRemove){
int id = buffer.readInt();
TransportLocation loc = TransportController.getInstance().removeLocation(id);
if(loc != null)
NoppesUtilServer.sendTransportData(player,loc.category.id);
}
else if(type == EnumPacketServer.TransportsGet){
NoppesUtilServer.sendTransportData(player,buffer.readInt());
}
else if(type == EnumPacketServer.TransportSave){
int cat = buffer.readInt();
TransportLocation location = TransportController.getInstance().saveLocation(cat, ByteBufUtils.readNBT(buffer), npc);
if(location != null){
if(npc.advanced.role != EnumRoleType.Transporter)
return;
RoleTransporter role = (RoleTransporter) npc.roleInterface;
role.setTransport(location);
}
}
else if(type == EnumPacketServer.TransportGetLocation){
if(npc.advanced.role != EnumRoleType.Transporter)
return;
RoleTransporter role = (RoleTransporter) npc.roleInterface;
if(role.hasTransport()){
GuiDataPacket.sendGuiData(player, role.getLocation().writeNBT());
ScrollSelectedPacket.setSelectedList(player, role.getLocation().category.title);
}
}
else if(type == EnumPacketServer.FactionSet){
npc.setFaction(buffer.readInt());
}
else if(type == EnumPacketServer.FactionSave){
Faction faction = new Faction();
faction.readNBT(ByteBufUtils.readNBT(buffer));
FactionController.getInstance().saveFaction(faction);
NoppesUtilServer.sendFactionDataAll(player);
NBTTagCompound compound = new NBTTagCompound();
faction.writeNBT(compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.FactionRemove){
FactionController.getInstance().delete(buffer.readInt());
NoppesUtilServer.sendFactionDataAll(player);
NBTTagCompound compound = new NBTTagCompound();
(new Faction()).writeNBT(compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.TagSet){
this.setTags(npc,buffer);
}
else if(type == EnumPacketServer.TagSave){
Tag tag = new Tag();
tag.readNBT(ByteBufUtils.readNBT(buffer));
TagController.getInstance().saveTag(tag);
NoppesUtilServer.sendTagDataAll(player);
NBTTagCompound compound = new NBTTagCompound();
tag.writeNBT(compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.TagRemove){
TagController.getInstance().delete(buffer.readInt());
NoppesUtilServer.sendTagDataAll(player);
NBTTagCompound compound = new NBTTagCompound();
(new Tag()).writeNBT(compound);
GuiDataPacket.sendGuiData(player, compound);
}
else if(type == EnumPacketServer.PlayerDataGet){
int id = buffer.readInt();
if(EnumPlayerData.values().length <= id)
return;
String name = null;
EnumPlayerData datatype = EnumPlayerData.values()[id];
if(datatype != EnumPlayerData.Players)
name = ByteBufUtils.readString(buffer);
NoppesUtilServer.sendPlayerData(datatype,player,name);
}
else if(type == EnumPacketServer.PlayerDataRemove){
NoppesUtilServer.removePlayerData(buffer,player);
}
else if(type == EnumPacketServer.PlayerDataMapRegen){
NoppesUtilServer.regenPlayerData(player);
}
else if(type == EnumPacketServer.MainmenuDisplayGet){
GuiDataPacket.sendGuiData(player, npc.display.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuDisplaySave){
npc.display.readToNBT(ByteBufUtils.readNBT(buffer));
npc.updateClient = true;
}
else if(type == EnumPacketServer.MainmenuStatsGet){
GuiDataPacket.sendGuiData(player, npc.stats.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuStatsSave){
npc.stats.readToNBT(ByteBufUtils.readNBT(buffer));
npc.updateClient = true;
}
else if(type == EnumPacketServer.MainmenuInvGet){
GuiDataPacket.sendGuiData(player, npc.inventory.writeEntityToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuInvSave){
npc.inventory.readEntityFromNBT(ByteBufUtils.readNBT(buffer));
npc.updateAI = true;
npc.updateClient = true;
}
else if(type == EnumPacketServer.MainmenuAIGet){
GuiDataPacket.sendGuiData(player, npc.ai.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuAISave){
npc.ai.readToNBT(ByteBufUtils.readNBT(buffer));
npc.setHealth(npc.getMaxHealth());
npc.updateAI = true;
npc.updateClient = true;
}
else if(type == EnumPacketServer.MainmenuAdvancedGet){
GuiDataPacket.sendGuiData(player, npc.advanced.writeToNBT(new NBTTagCompound()));
}
else if(type == EnumPacketServer.MainmenuAdvancedSave){
npc.advanced.readToNBT(ByteBufUtils.readNBT(buffer));
npc.updateAI = true;
npc.updateClient = true;
}
else if(type == EnumPacketServer.MainmenuAdvancedMarkData){
MarkData data = MarkData.get(npc);
data.setNBT(ByteBufUtils.readNBT(buffer));
data.syncClients();
}
else if(type == EnumPacketServer.JobSave){
NBTTagCompound original = npc.jobInterface.writeToNBT(new NBTTagCompound());
NBTTagCompound compound = ByteBufUtils.readNBT(buffer);
@@ -880,10 +744,6 @@ public class PacketHandlerServer{
compound.setTag("ShortTags", validTagList);
GuiDataPacket.sendGuiData(player, compound);
}
else if (type == EnumPacketServer.TagSet) {
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
this.setTags(npc,buffer);
}
else if (type != EnumPacketServer.NpcTagsGet && type != EnumPacketServer.TagsGet) {
warn(player, "WE 2 tried todo something with the wrong tool, probably a hacker");
}