summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTravis Watkins <amaranth@ubuntu.com>2012-11-18 20:18:30 -0600
committerEvilSeph <evilseph@gmail.com>2012-11-18 21:27:48 -0500
commit8f4cde24bd2fee0c0b9617a7867422f5c901596b (patch)
treea0e6d5a0a7e8b48b5dbeaacbcd935fa385a545f7 /src
parentcc78e173124747d3cdb5c588fafa1df8f9b81f47 (diff)
downloadcraftbukkit-8f4cde24bd2fee0c0b9617a7867422f5c901596b.tar
craftbukkit-8f4cde24bd2fee0c0b9617a7867422f5c901596b.tar.gz
craftbukkit-8f4cde24bd2fee0c0b9617a7867422f5c901596b.tar.lz
craftbukkit-8f4cde24bd2fee0c0b9617a7867422f5c901596b.tar.xz
craftbukkit-8f4cde24bd2fee0c0b9617a7867422f5c901596b.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java8
1 files 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 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);