3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-20 21:40:06 +01:00

Ensure entity isn't destroyed when trying to show it. Fixes BUKKIT-2038

If two players (or a player and any other entity) are teleported to the
same location in the same tick they will both get added to the other's
destroy queue then have a new entity spawn packet sent. Next tick the
destroy queue will be processed and they will then be invisible to each
other. To prevent this situation we remove the entity from the destroy
queue when sending out a spawn packet for them.
Dieser Commit ist enthalten in:
Travis Watkins 2012-10-13 15:27:45 -05:00
Ursprung cb2f8244e9
Commit 506a1a0765
2 geänderte Dateien mit 4 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -234,12 +234,14 @@ public class EntityTrackerEntry {
if (d0 >= (double) (-this.b) && d0 <= (double) this.b && d1 >= (double) (-this.b) && d1 <= (double) this.b) { if (d0 >= (double) (-this.b) && d0 <= (double) this.b && d1 >= (double) (-this.b) && d1 <= (double) this.b) {
if (!this.trackedPlayers.contains(entityplayer) && this.d(entityplayer)) { if (!this.trackedPlayers.contains(entityplayer) && this.d(entityplayer)) {
// CraftBukkit start // CraftBukkit start
if (tracker instanceof EntityPlayer) { if (this.tracker instanceof EntityPlayer) {
Player player = ((EntityPlayer) tracker).getBukkitEntity(); Player player = ((EntityPlayer) this.tracker).getBukkitEntity();
if (!entityplayer.getBukkitEntity().canSee(player)) { if (!entityplayer.getBukkitEntity().canSee(player)) {
return; return;
} }
} }
entityplayer.g.remove(Integer.valueOf(this.tracker.id)); // Should be called destroyQueue
// CraftBukkit end // CraftBukkit end
this.trackedPlayers.add(entityplayer); this.trackedPlayers.add(entityplayer);
Packet packet = this.b(); Packet packet = this.b();

Datei anzeigen

@ -631,7 +631,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
EntityTracker tracker = ((WorldServer) entity.world).tracker; EntityTracker tracker = ((WorldServer) entity.world).tracker;
EntityPlayer other = ((CraftPlayer) player).getHandle(); EntityPlayer other = ((CraftPlayer) player).getHandle();
EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.id); EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.id);
getHandle().g.remove(Integer.valueOf(other.id)); // Should be called destroyQueue
if (entry != null && !entry.trackedPlayers.contains(getHandle())) { if (entry != null && !entry.trackedPlayers.contains(getHandle())) {
entry.updatePlayer(getHandle()); entry.updatePlayer(getHandle());
} }