From dfbcd36ab7b0f7e8d26ca256b789509f0fc5a6fb Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sat, 14 Jan 2012 18:12:59 +0000 Subject: [PATCH] Fixed a further exploit with players attacking more things that they shouldn't. --- src/main/java/net/minecraft/server/EntityPlayer.java | 2 +- src/main/java/net/minecraft/server/NetServerHandler.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index b9ca7d3703..a141c7f0a5 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -648,7 +648,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.deathTicks = 0; effects.clear(); this.activeContainer = this.defaultContainer; - this.lastSentExp = -1; // lastSentExp. Find line: "if (this.expTotal != this.XXXX) {" + this.lastSentExp = -1; if(this.keepLevel) { this.exp = exp; } else { diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index ecdad7daa3..9f98355e30 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -923,9 +923,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener { this.player.updateInventory(this.player.activeContainer); } } else if (packet7useentity.c == 1) { - if (entity instanceof EntityItem) { - disconnect("Attacking an item is not permitted"); - System.out.println("Player " + player.name + " tried to attack an item entity, so I have disconnected them for exploiting."); + if ((entity instanceof EntityItem) || (entity instanceof EntityExperienceOrb) || (entity instanceof EntityArrow)) { + String type = entity.getClass().getSimpleName(); + disconnect("Attacking an " + type + " is not permitted"); + System.out.println("Player " + player.name + " tried to attack an " + type + ", so I have disconnected them for exploiting."); return; }