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

Fix teleport failing right after join. Fixes BUKKIT-5479

Teleporting a player checks to see if the player is disconnected to
try to avoid creating ghost players. The check it uses, however, randomly
fails when the player is in the middle of joining the server. The check
that would work correctly here does not work correctly when the player
actually disconnects. To work around this we add a new flag which is
cleared on the first tick of the new player and assume they are connected
if the flag is set.
Dieser Commit ist enthalten in:
Travis Watkins 2014-03-22 19:25:55 -05:00
Ursprung 4873b12890
Commit 019a33f50d
3 geänderte Dateien mit 14 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -61,6 +61,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public int newTotalExp = 0; public int newTotalExp = 0;
public boolean keepLevel = false; public boolean keepLevel = false;
public double maxHealthCache; public double maxHealthCache;
public boolean joining = true;
// CraftBukkit end // CraftBukkit end
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
@ -159,6 +160,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void h() { public void h() {
// CraftBukkit start
if (this.joining) {
this.joining = false;
}
// CraftBukkit end
this.playerInteractManager.a(); this.playerInteractManager.a();
--this.invulnerableTicks; --this.invulnerableTicks;
if (this.noDamageTicks > 0) { if (this.noDamageTicks > 0) {

Datei anzeigen

@ -1850,7 +1850,7 @@ public class PlayerConnection implements PacketPlayInListener {
// CraftBukkit start - Add "isDisconnected" method // CraftBukkit start - Add "isDisconnected" method
public final boolean isDisconnected() { public final boolean isDisconnected() {
return !NetworkManager.a(this.networkManager).config().isAutoRead(); return !this.player.joining && !NetworkManager.a(this.networkManager).config().isAutoRead();
} }
// CraftBukkit end // CraftBukkit end
} }

Datei anzeigen

@ -83,8 +83,8 @@ public abstract class PlayerList {
s = networkmanager.getSocketAddress().toString(); s = networkmanager.getSocketAddress().toString();
} }
// CraftBukkit - add world to 'logged in' message. // CraftBukkit - Moved message to after join
c.info(entityplayer.getName() + "[" + s + "] logged in with entity id " + entityplayer.getId() + " at ([" + entityplayer.world.worldData.getName() + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); // c.info(entityplayer.getName() + "[" + s + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
ChunkCoordinates chunkcoordinates = worldserver.getSpawn(); ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
@ -114,6 +114,7 @@ public abstract class PlayerList {
this.sendMessage(chatmessage); this.sendMessage(chatmessage);
// CraftBukkit end*/ // CraftBukkit end*/
this.c(entityplayer); this.c(entityplayer);
worldserver = this.server.getWorldServer(entityplayer.dimension); // CraftBukkit - Update in case join event changed it
playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.b(entityplayer, worldserver); this.b(entityplayer, worldserver);
if (this.server.getResourcePack().length() > 0) { if (this.server.getResourcePack().length() > 0) {
@ -139,6 +140,9 @@ public abstract class PlayerList {
entity.n = false; entity.n = false;
} }
} }
// CraftBukkit - Moved from above, added world
c.info(entityplayer.getName() + "[" + s + "] logged in with entity id " + entityplayer.getId() + " at ([" + entityplayer.world.worldData.getName() + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
} }
public void a(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) { // CraftBukkit - protected -> public public void a(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) { // CraftBukkit - protected -> public