Added console output and correct script halting to scripted player events. Renamed PlayerScriptContainer to EventScriptContainer.

This commit is contained in:
luisc committed 2021-10-17 16:11:29 -05:00
1 parent a9bce4a3e3
commit c5ed7497c8
9 files changed
+149 -130

No files matched your search

@@ -62,6 +62,8 @@ import noppes.npcs.controllers.SpawnController;
import noppes.npcs.controllers.SpawnData;
import noppes.npcs.controllers.TransportController;
import noppes.npcs.controllers.TransportLocation;
import noppes.npcs.controllers.data.ForgeDataScript;
import noppes.npcs.controllers.data.PlayerDataScript;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.roles.JobSpawner;
@@ -108,6 +110,8 @@ public class PacketHandlerServer{
featherPackets(type, buffer, player);
else if(type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave)
playerScriptPackets(type, buffer, player);
else if(type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave)
forgeScriptPackets(type, buffer, player);
else if(item.getItem() == CustomItems.scripter)
scriptPackets(type, buffer, player, npc);
else if(item.getItem() == Item.getItemFromBlock(CustomItems.waypoint) || item.getItem() == Item.getItemFromBlock(CustomItems.border) || item.getItem() == Item.getItemFromBlock(CustomItems.redstoneBlock))
@@ -133,7 +137,8 @@ public class PacketHandlerServer{
private void playerScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
NBTTagCompound compound;
if(type == EnumPacketServer.ScriptPlayerGet) {
compound = ScriptController.Instance.playerScripts.writeToNBT(new NBTTagCompound());
PlayerDataScript data = ScriptController.Instance.playerScripts;
compound = data.writeToNBT(new NBTTagCompound());
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
} else if(type == EnumPacketServer.ScriptPlayerSave) {
@@ -141,6 +146,18 @@ public class PacketHandlerServer{
}
}
private void forgeScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
NBTTagCompound compound;
if (type == EnumPacketServer.ScriptForgeGet) {
ForgeDataScript data = ScriptController.Instance.forgeScripts;
compound = data.writeToNBT(new NBTTagCompound());
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
Server.sendData(player, EnumPacketClient.GUI_DATA, new Object[]{compound});
} else if (type == EnumPacketServer.ScriptForgeSave) {
ScriptController.Instance.setForgeScripts(Server.readNBT(buffer));
}
}
private void featherPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
if(type == EnumPacketServer.DimensionsGet){
HashMap<String,Integer> map = new HashMap<String,Integer>();