From 8f4cde24bd2fee0c0b9617a7867422f5c901596b Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Sun, 18 Nov 2012 20:18:30 -0600 Subject: [PATCH] Don't add player to world if join event did it already. On join we unconditionally add the player to the world they logged out in. If a plugin teleports a player during PlayerJoinEvent in a way that adds them to a world (cross-world teleport) we end up with one player in two places. To avoid this we check to see if the player has changed worlds or is already added to the world we have we skip adding them again. --- .../server/ServerConfigurationManagerAbstract.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java b/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java index 102d162616..3332cdf126 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java @@ -160,8 +160,12 @@ public abstract class ServerConfigurationManagerAbstract { this.cserver.onPlayerJoin(playerJoinEvent.getPlayer()); // CraftBukkit end - worldserver.addEntity(entityplayer); - this.a(entityplayer, (WorldServer) null); + // CraftBukkit start - only add if the player wasn't moved in the event + if (entityplayer.world == worldserver && !worldserver.players.contains(entityplayer)) { + worldserver.addEntity(entityplayer); + this.a(entityplayer, (WorldServer) null); + } + // CraftBukkit end // CraftBukkit start - sendAll above replaced with this loop Packet201PlayerInfo packet = new Packet201PlayerInfo(entityplayer.listName, true, 1000);