summaryrefslogtreecommitdiffstats
path: root/nms-patches/WorldManager.patch
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2015-06-07 21:04:28 +0100
committerThinkofdeath <thinkofdeath@spigotmc.org>2015-06-07 21:04:28 +0100
commit53433de98d7e83dca4ff77d83447e7fca57d3639 (patch)
tree7e6c0a7a0aa4ed915c41d0a3350563e74de296d7 /nms-patches/WorldManager.patch
parent845336b511bdd3d3d9b8a67346503acc4ad3396a (diff)
downloadcraftbukkit-53433de98d7e83dca4ff77d83447e7fca57d3639.tar
craftbukkit-53433de98d7e83dca4ff77d83447e7fca57d3639.tar.gz
craftbukkit-53433de98d7e83dca4ff77d83447e7fca57d3639.tar.lz
craftbukkit-53433de98d7e83dca4ff77d83447e7fca57d3639.tar.xz
craftbukkit-53433de98d7e83dca4ff77d83447e7fca57d3639.zip
SPIGOT-954: Don't send block animations or gamemode updates to players can't see the player
Diffstat (limited to 'nms-patches/WorldManager.patch')
-rw-r--r--nms-patches/WorldManager.patch26
1 files changed, 26 insertions, 0 deletions
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));
+ }