Prevent players from being kicked for attacking enderdragon

This commit is contained in:
libraryaddict 2013-12-22 17:55:34 +13:00
parent a3ddce6c5f
commit 038b6478ea
2 changed files with 5 additions and 7 deletions

View File

@ -116,7 +116,8 @@ public class PacketsManager {
Player observer = event.getPlayer();
StructureModifier<Entity> entityModifer = event.getPacket().getEntityModifier(observer.getWorld());
org.bukkit.entity.Entity entity = entityModifer.read(ReflectionManager.isAfter17() ? 0 : 1);
if (entity instanceof ExperienceOrb || entity instanceof Item || entity instanceof Arrow) {
if (entity instanceof ExperienceOrb || entity instanceof Item || entity instanceof Arrow
|| entity == observer) {
event.setCancelled(true);
}
} catch (Exception e) {

View File

@ -258,16 +258,13 @@ public class ReflectionManager {
stage++;
switch (stage) {
case 1:
x = field.getDouble(boundingBox); //+ oldBox.getX();
// field.setDouble(boundingBox, x - newBox.getX());
x = field.getDouble(boundingBox);
break;
case 2:
y = field.getDouble(boundingBox);// + oldBox.getY();
// field.setDouble(boundingBox, y - newBox.getY());
y = field.getDouble(boundingBox);
break;
case 3:
z = field.getDouble(boundingBox); //+ oldBox.getZ();
// field.setDouble(boundingBox, z - newBox.getZ());
z = field.getDouble(boundingBox);
break;
case 4:
field.setDouble(boundingBox, x + newBox.getX());