mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 15:45:10 +00:00
Added isGUIOpen() function, and setPosition function with a dimensionId parameter to ScriptPlayer.
This commit is contained in:
1 parent
27b88c1fce
commit
0d807b36d9
13 files changed
+84
-17
No files matched your search
@@ -9,7 +9,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
@@ -90,13 +89,19 @@ public class PacketHandlerServer{
|
||||
ItemStack item = player.inventory.getCurrentItem();
|
||||
|
||||
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
|
||||
|
||||
if(type == EnumPacketServer.IsGuiOpen) {
|
||||
isGuiOpenPacket(buffer, player);
|
||||
return;
|
||||
}
|
||||
|
||||
if(type.needsNpc && npc == null){
|
||||
|
||||
}
|
||||
else if(type.hasPermission() && !CustomNpcsPermissions.Instance.hasPermission(player, type.permission)){
|
||||
//player doesnt have permission todo this
|
||||
//player doesnt have permission to do this
|
||||
}
|
||||
else if(item == null )
|
||||
else if(item == null && (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave || type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave))
|
||||
warn(player, "tried to use custom npcs without a tool in hand, probably a hacker");
|
||||
else if(item.getItem() == CustomItems.wand)
|
||||
wandPackets(type, buffer, player, npc);
|
||||
@@ -120,7 +125,11 @@ public class PacketHandlerServer{
|
||||
LogWriter.error("Error with EnumPacketServer." + type, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void isGuiOpenPacket(ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||
NoppesUtilServer.isGUIOpen(buffer, player);
|
||||
}
|
||||
|
||||
private void scriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws Exception {
|
||||
if(type == EnumPacketServer.ScriptDataSave){
|
||||
npc.script.readFromNBT(Server.readNBT(buffer));
|
||||
|
||||
Reference in new issue
Block a user