diff --git a/src/main/java/xyz/yooniks/exploitpatch/bukkit/ExploitPatchPlugin.java b/src/main/java/xyz/yooniks/exploitpatch/bukkit/ExploitPatchPlugin.java index 00fab2d..4c7319f 100644 --- a/src/main/java/xyz/yooniks/exploitpatch/bukkit/ExploitPatchPlugin.java +++ b/src/main/java/xyz/yooniks/exploitpatch/bukkit/ExploitPatchPlugin.java @@ -36,8 +36,10 @@ public void onEnable() { final ConnectionCloser connectionCloser = new DefaultConnectionCloser(this); if (this.getConfig().getBoolean("arm-animation.enabled")) { - this.protocolManager.addPacketListener(new ArmAnimationListener(this, - this.getConfig().getLong("arm-animation.timestamp"))); + final ArmAnimationListener armAnimationListener = new ArmAnimationListener(this, + this.getConfig().getLong("arm-animation.timestamp")); + this.protocolManager.addPacketListener(armAnimationListener); + this.getServer().getPluginManager().registerEvents(armAnimationListener, this); } this.protocolManager.addPacketListener(new ItemPacketListener( diff --git a/src/main/java/xyz/yooniks/exploitpatch/bukkit/listener/ItemPacketListener.java b/src/main/java/xyz/yooniks/exploitpatch/bukkit/listener/ItemPacketListener.java index 44601ad..ba5b6c2 100644 --- a/src/main/java/xyz/yooniks/exploitpatch/bukkit/listener/ItemPacketListener.java +++ b/src/main/java/xyz/yooniks/exploitpatch/bukkit/listener/ItemPacketListener.java @@ -28,6 +28,7 @@ public ItemPacketListener(Plugin plugin, ConnectionCloser connectionCloser, List public void onPacketReceiving(PacketEvent event) { final Player player = event.getPlayer(); if (player == null || this.connectionCloser.isClosing(player)) { + event.setCancelled(true); return; } final PacketContainer packet = event.getPacket(); diff --git a/src/main/java/xyz/yooniks/exploitpatch/bukkit/nbt/NBTBigDataChecker.java b/src/main/java/xyz/yooniks/exploitpatch/bukkit/nbt/NBTBigDataChecker.java index de528c2..81cd85d 100644 --- a/src/main/java/xyz/yooniks/exploitpatch/bukkit/nbt/NBTBigDataChecker.java +++ b/src/main/java/xyz/yooniks/exploitpatch/bukkit/nbt/NBTBigDataChecker.java @@ -24,6 +24,8 @@ public boolean isInvalid(ItemStack item) { return compound.getKeys().stream() .map(compound::getValue) .anyMatch(value -> value.getName().length() > 100 + || (value.getValue() instanceof String && ((String) value.getValue()).length() > 100) + //not checking every tag in nbtlist =/ i hope it's not needed, cuz nbt has already some limit || (value instanceof NbtList && ((NbtList) value).size() > 55)); }