summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft
diff options
context:
space:
mode:
authorRaphfrk <raphfrk@gmail.com>2011-03-26 11:31:48 +0000
committerErik Broes <erikbroes@grum.nl>2011-03-26 15:07:55 +0100
commitabf7f8581ee366c5951f230f4c44849ecfe7b472 (patch)
treebc9a5ae634d71226cb0b815e802919c630ba9b59 /src/main/java/net/minecraft
parent8e53077efe2eceb6b9c745073ff821982142593c (diff)
downloadcraftbukkit-abf7f8581ee366c5951f230f4c44849ecfe7b472.tar
craftbukkit-abf7f8581ee366c5951f230f4c44849ecfe7b472.tar.gz
craftbukkit-abf7f8581ee366c5951f230f4c44849ecfe7b472.tar.lz
craftbukkit-abf7f8581ee366c5951f230f4c44849ecfe7b472.tar.xz
craftbukkit-abf7f8581ee366c5951f230f4c44849ecfe7b472.zip
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
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r--src/main/java/net/minecraft/server/NetLoginHandler.java2
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java5
-rw-r--r--src/main/java/net/minecraft/server/ServerConfigurationManager.java11
3 files changed, 15 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java
index bdd85f19..a2dcf2eb 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 1ea515cc..ba060ff8 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 34ac6497..d028298a 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