diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java index bdd85f1988..a2dcf2ebb5 100644 --- a/src/main/java/net/minecraft/server/NetLoginHandler.java +++ b/src/main/java/net/minecraft/server/NetLoginHandler.java @@ -83,7 +83,7 @@ public class NetLoginHandler extends NetHandler { ChunkCoordinates chunkcoordinates = entityplayer.world.l(); netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.j(), (byte) entityplayer.world.m.g))); netserverhandler.b((Packet) (new Packet6SpawnPosition(chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c))); - this.e.f.a((Packet) (new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game."))); + // this.e.f.a((Packet) (new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game."))); // CraftBukkit - message moved to join event this.e.f.a(entityplayer); netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); this.e.c.a(netserverhandler); diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 1ea515cca0..ba060ff8f4 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -90,7 +90,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener { // Send the possibly modified leave message this.b.a((Packet) (new Packet255KickDisconnect( event.getReason() ))); this.b.c(); - this.d.f.a((Packet) (new Packet3Chat( event.getLeaveMessage() ))); + leaveMessage = event.getLeaveMessage(); + if (leaveMessage != null) { + this.d.f.a((Packet) (new Packet3Chat(leaveMessage))); + } // CraftBukkit end this.d.f.c(this.e); diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 34ac64974d..d028298a79 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -21,6 +21,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.Event.Type; import org.bukkit.event.player.PlayerEvent; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerRespawnEvent; // CraftBukkit end @@ -94,7 +95,15 @@ public class ServerConfigurationManager { entityplayer.world.a(entityplayer); - server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_JOIN, server.getPlayer(entityplayer))); + PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(PlayerEvent.Type.PLAYER_JOIN, server.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game."); + + server.getPluginManager().callEvent(playerJoinEvent); + + String joinMessage = playerJoinEvent.getJoinMessage(); + + if (joinMessage != null) { + this.c.f.a((Packet) (new Packet3Chat(joinMessage))); + } ((WorldServer) entityplayer.world).manager.a(entityplayer); // CraftBukkit end