SPIGOT-954: Don't send block animations or gamemode updates to players can't see the player
Dieser Commit ist enthalten in:
Ursprung
845336b511
Commit
53433de98d
@ -14,6 +14,15 @@
|
||||
public class PlayerInteractManager {
|
||||
|
||||
public World world;
|
||||
@@ -26,7 +34,7 @@
|
||||
this.gamemode = worldsettings_enumgamemode;
|
||||
worldsettings_enumgamemode.a(this.player.abilities);
|
||||
this.player.updateAbilities();
|
||||
- this.player.server.getPlayerList().sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE, new EntityPlayer[] { this.player}));
|
||||
+ this.player.server.getPlayerList().sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE, new EntityPlayer[] { this.player}), this.player); // CraftBukkit
|
||||
}
|
||||
|
||||
public WorldSettings.EnumGamemode getGameMode() {
|
||||
@@ -50,7 +58,7 @@
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren