Archiviert
13
0

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

Dieser Commit ist enthalten in:
Raphfrk 2011-03-26 11:31:48 +00:00 committet von Erik Broes
Ursprung 8e53077efe
Commit abf7f8581e
3 geänderte Dateien mit 15 neuen und 3 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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