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/PlayerList.patch | 52 ++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 21 deletions(-) (limited to 'nms-patches/PlayerList.patch') diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch index 28ca82c0..e12cf832 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -579,12 +579,12 @@ + double d1 = enter.getZ(); + double d2 = 8.0D; + /* -+ double d0 = entity.locX; -+ double d1 = entity.locZ; -+ double d2 = 8.0D; -+ float f = entity.yaw; -+ -+ worldserver.methodProfiler.a("moving"); + double d0 = entity.locX; + double d1 = entity.locZ; + double d2 = 8.0D; + float f = entity.yaw; + + worldserver.methodProfiler.a("moving"); + */ + if (worldserver1.dimension == -1) { + d0 = MathHelper.a(d0 / d2, worldserver1.getWorldBorder().b()+ 16.0D, worldserver1.getWorldBorder().d() - 16.0D); @@ -654,12 +654,12 @@ + int i = worldserver.dimension; + + /* - double d0 = entity.locX; - double d1 = entity.locZ; - double d2 = 8.0D; - float f = entity.yaw; - - worldserver.methodProfiler.a("moving"); ++ double d0 = entity.locX; ++ double d1 = entity.locZ; ++ double d2 = 8.0D; ++ float f = entity.yaw; ++ ++ worldserver.methodProfiler.a("moving"); + */ + entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); + if (entity.isAlive()) { @@ -715,11 +715,21 @@ } public void tick() { -@@ -494,6 +858,15 @@ +@@ -494,6 +858,25 @@ } -+ // CraftBukkit start - add a world limited version ++ // CraftBukkit start - add a world/entity limited version ++ public void sendAll(Packet packet, EntityHuman entityhuman) { ++ for (int i = 0; i < this.players.size(); ++i) { ++ EntityPlayer entityplayer = this.players.get(i); ++ if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) { ++ continue; ++ } ++ ((EntityPlayer) this.players.get(i)).playerConnection.sendPacket(packet); ++ } ++ } ++ + public void sendAll(Packet packet, World world) { + for (int i = 0; i < world.players.size(); ++i) { + ((EntityPlayer) this.players.get(i)).playerConnection.sendPacket(packet); @@ -731,7 +741,7 @@ public void a(Packet packet, int i) { for (int j = 0; j < this.players.size(); ++j) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(j); -@@ -589,10 +962,24 @@ +@@ -589,10 +972,24 @@ public void addOp(GameProfile gameprofile) { this.operators.add(new OpListEntry(gameprofile, this.server.p(), this.operators.b(gameprofile))); @@ -756,7 +766,7 @@ } public boolean isWhitelisted(GameProfile gameprofile) { -@@ -600,7 +987,7 @@ +@@ -600,7 +997,7 @@ } public boolean isOp(GameProfile gameprofile) { @@ -765,7 +775,7 @@ } public EntityPlayer getPlayer(String s) { -@@ -627,6 +1014,12 @@ +@@ -627,6 +1024,12 @@ for (int j = 0; j < this.players.size(); ++j) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(j); @@ -778,7 +788,7 @@ if (entityplayer != entityhuman && entityplayer.dimension == i) { double d4 = d0 - entityplayer.locX; double d5 = d1 - entityplayer.locY; -@@ -674,21 +1067,26 @@ +@@ -674,21 +1077,26 @@ public void reloadWhitelist() {} public void b(EntityPlayer entityplayer, WorldServer worldserver) { @@ -810,7 +820,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex)); } -@@ -701,7 +1099,7 @@ +@@ -701,7 +1109,7 @@ } public String[] getSeenPlayers() { @@ -819,7 +829,7 @@ } public boolean getHasWhitelist() { -@@ -751,16 +1149,26 @@ +@@ -751,16 +1159,26 @@ public void u() { for (int i = 0; i < this.players.size(); ++i) { @@ -848,7 +858,7 @@ } public void sendMessage(IChatBaseComponent ichatbasecomponent) { -@@ -797,8 +1205,10 @@ +@@ -797,8 +1215,10 @@ WorldServer[] aworldserver = this.server.worldServer; int j = aworldserver.length; -- cgit v1.2.3