From 53433de98d7e83dca4ff77d83447e7fca57d3639 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sun, 7 Jun 2015 21:04:28 +0100 Subject: SPIGOT-954: Don't send block animations or gamemode updates to players can't see the player --- nms-patches/WorldManager.patch | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'nms-patches/WorldManager.patch') diff --git a/nms-patches/WorldManager.patch b/nms-patches/WorldManager.patch index cbf37c13..4a9fa5b4 100644 --- a/nms-patches/WorldManager.patch +++ b/nms-patches/WorldManager.patch @@ -26,3 +26,29 @@ } public void a(int i, BlockPosition blockposition, int j) { +@@ -52,6 +55,12 @@ + public void b(int i, BlockPosition blockposition, int j) { + Iterator iterator = this.a.getPlayerList().v().iterator(); + ++ // CraftBukkit start ++ EntityHuman entityhuman = null; ++ Entity entity = world.a(i); // PAIL Rename getEntity ++ if (entity instanceof EntityHuman) entityhuman = (EntityHuman) entity; ++ // CraftBukkit end ++ + while (iterator.hasNext()) { + EntityPlayer entityplayer = (EntityPlayer) iterator.next(); + +@@ -60,6 +69,12 @@ + double d1 = (double) blockposition.getY() - entityplayer.locY; + double d2 = (double) blockposition.getZ() - entityplayer.locZ; + ++ // CraftBukkit start ++ if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) { ++ continue; ++ } ++ // CraftBukkit end ++ + if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { + entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j)); + } -- cgit v1.2.3