From 121bcd5adc5b653ccc59be6ecac2b72ed29397ee Mon Sep 17 00:00:00 2001 From: Raphfrk Date: Sat, 2 Apr 2011 15:42:11 +0100 Subject: [PATCH] Added the ability to set the quit message --- src/main/java/net/minecraft/server/NetServerHandler.java | 6 ++++-- .../net/minecraft/server/ServerConfigurationManager.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 43a99ab7bf..d60d4b4988 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -500,8 +500,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener { // CraftBukkit start -- rarely it would send a disconnect line twice if (!this.c) { a.info(this.e.name + " lost connection: " + s); - this.d.f.a((Packet) (new Packet3Chat("\u00A7e" + this.e.name + " left the game."))); - this.d.f.c(this.e); + String quitMessage = this.d.f.c(this.e); + if (quitMessage != null) { + this.d.f.a((Packet) (new Packet3Chat(quitMessage))); + } } // CraftBukkit end this.c = true; diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 742ab54c52..0d71c5209f 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -111,14 +111,16 @@ public class ServerConfigurationManager { ((WorldServer) entityplayer.world).manager.c(entityplayer); // CraftBukkit } - public void c(EntityPlayer entityplayer) { + public String c(EntityPlayer entityplayer) { // CraftBukkit - changed return type this.n.a(entityplayer); entityplayer.world.d(entityplayer); // CraftBukkit this.b.remove(entityplayer); // CraftBukkit start ((WorldServer) entityplayer.world).manager.b(entityplayer); - server.getPluginManager().callEvent(new PlayerQuitEvent(server.getPlayer(entityplayer))); // CraftBukkit + PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(server.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game."); + server.getPluginManager().callEvent(playerQuitEvent); + return playerQuitEvent.getQuitMessage(); // CraftBukkit end }