From 8f4cde24bd2fee0c0b9617a7867422f5c901596b Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Sun, 18 Nov 2012 20:18:30 -0600 Subject: 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. --- .../net/minecraft/server/ServerConfigurationManagerAbstract.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main/java/net') diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java b/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java index 102d1626..3332cdf1 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); -- cgit v1.2.3