summaryrefslogtreecommitdiffstats
path: root/nms-patches/PlayerList.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/PlayerList.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/PlayerList.patch')
-rw-r--r--nms-patches/PlayerList.patch52
1 files changed, 31 insertions, 21 deletions
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;