Added ability to disable the join/leave notices by setting the message to null in the event. The join message is moved to the onJoinEvent rather than during login

This commit is contained in:
Raphfrk
2011-03-26 11:31:48 +00:00
committed by Erik Broes
parent 8e53077efe
commit abf7f8581e
3 changed files with 15 additions and 3 deletions

View File

@@ -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