SPIGOT-954: Don't send block animations or gamemode updates to players can't see the player
By: Thinkofdeath <thinkofdeath@spigotmc.org>
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user