2015-04-09 03:18:56 +00:00
|
|
|
From 769c5e34732090c8d4396d99692bd82a0134c3b3 Mon Sep 17 00:00:00 2001
|
2014-07-21 20:46:54 +00:00
|
|
|
From: md_5 <md_5@live.com.au>
|
|
|
|
Date: Fri, 21 Jun 2013 19:21:58 +1000
|
|
|
|
Subject: [PATCH] Configurable Messages
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
|
2015-02-28 11:36:22 +00:00
|
|
|
index 98f40f1..8f421f3 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
|
2014-11-28 01:17:45 +00:00
|
|
|
@@ -62,11 +62,11 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
2014-07-21 20:46:54 +00:00
|
|
|
// CraftBukkit end
|
|
|
|
|
2014-11-28 01:17:45 +00:00
|
|
|
if (packethandshakinginsetprotocol.b() > 47) {
|
2015-02-28 11:36:22 +00:00
|
|
|
- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.3");
|
|
|
|
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage, "1.8.3" ) ); // Spigot
|
2014-11-28 01:17:45 +00:00
|
|
|
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
|
2014-07-21 20:46:54 +00:00
|
|
|
this.b.close(chatcomponenttext);
|
2014-11-28 01:17:45 +00:00
|
|
|
} else if (packethandshakinginsetprotocol.b() < 47) {
|
2015-02-28 11:36:22 +00:00
|
|
|
- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.8.3");
|
|
|
|
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage, "1.8.3" ) ); // Spigot
|
2014-11-28 01:17:45 +00:00
|
|
|
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
|
2014-07-21 20:46:54 +00:00
|
|
|
this.b.close(chatcomponenttext);
|
|
|
|
} else {
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
2015-04-09 03:18:56 +00:00
|
|
|
index ba7f18c..146e186 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
2015-02-28 11:36:22 +00:00
|
|
|
@@ -418,7 +418,7 @@ public abstract class PlayerList {
|
2014-07-21 20:46:54 +00:00
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s);
|
|
|
|
} else if (!this.isWhitelisted(gameprofile)) {
|
|
|
|
// return "You are not white-listed on this server!";
|
|
|
|
- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!");
|
|
|
|
+ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot
|
2014-11-28 01:17:45 +00:00
|
|
|
} else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
|
|
|
|
IpBanEntry ipbanentry = this.l.get(socketaddress);
|
2014-07-21 20:46:54 +00:00
|
|
|
|
2015-02-28 11:36:22 +00:00
|
|
|
@@ -432,7 +432,7 @@ public abstract class PlayerList {
|
2014-07-21 20:46:54 +00:00
|
|
|
} else {
|
|
|
|
// return this.players.size() >= this.maxPlayers ? "The server is full!" : null;
|
|
|
|
if (this.players.size() >= this.maxPlayers) {
|
2014-11-28 01:17:45 +00:00
|
|
|
- event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full");
|
2014-07-21 20:46:54 +00:00
|
|
|
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2015-02-28 11:36:22 +00:00
|
|
|
index 905573c..f0453e6 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2015-01-24 23:37:00 +00:00
|
|
|
@@ -628,11 +628,7 @@ public final class CraftServer implements Server {
|
2014-07-21 20:46:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (sender instanceof Player) {
|
|
|
|
- sender.sendMessage("Unknown command. Type \"/help\" for help.");
|
|
|
|
- } else {
|
|
|
|
- sender.sendMessage("Unknown command. Type \"help\" for help.");
|
|
|
|
- }
|
|
|
|
+ sender.sendMessage(org.spigotmc.SpigotConfig.unknownCommandMessage);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
2014-11-28 01:17:45 +00:00
|
|
|
index 0a6ab75..95bb141 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
|
|
@@ -12,6 +12,7 @@ import java.util.Map;
|
|
|
|
import java.util.logging.Level;
|
|
|
|
import net.minecraft.server.MinecraftServer;
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
+import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.configuration.InvalidConfigurationException;
|
|
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
2014-07-30 08:35:19 +00:00
|
|
|
@@ -171,4 +172,28 @@ public class SpigotConfig
|
2014-07-21 20:46:54 +00:00
|
|
|
}
|
|
|
|
tabComplete = getInt( "commands.tab-complete", 0 );
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public static String whitelistMessage;
|
|
|
|
+ public static String unknownCommandMessage;
|
|
|
|
+ public static String serverFullMessage;
|
2014-11-28 01:17:45 +00:00
|
|
|
+ public static String outdatedClientMessage = "Outdated client! Please use {0}";
|
2014-07-21 20:46:54 +00:00
|
|
|
+ public static String outdatedServerMessage = "Outdated server! I\'m still on {0}";
|
|
|
|
+ private static String transform(String s)
|
|
|
|
+ {
|
|
|
|
+ return ChatColor.translateAlternateColorCodes( '&', s ).replaceAll( "\\n", "\n" );
|
|
|
|
+ }
|
|
|
|
+ private static void messages()
|
|
|
|
+ {
|
2014-11-28 01:17:45 +00:00
|
|
|
+ if (version < 8)
|
2014-07-21 20:46:54 +00:00
|
|
|
+ {
|
|
|
|
+ set( "messages.outdated-client", outdatedClientMessage );
|
|
|
|
+ set( "messages.outdated-server", outdatedServerMessage );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ whitelistMessage = transform( getString( "messages.whitelist", "You are not whitelisted on this server!" ) );
|
|
|
|
+ unknownCommandMessage = transform( getString( "messages.unknown-command", "Unknown command. Type \"/help\" for help." ) );
|
|
|
|
+ serverFullMessage = transform( getString( "messages.server-full", "The server is full!" ) );
|
|
|
|
+ outdatedClientMessage = transform( getString( "messages.outdated-client", outdatedClientMessage ) );
|
|
|
|
+ outdatedServerMessage = transform( getString( "messages.outdated-server", outdatedServerMessage ) );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
2014-11-28 01:17:45 +00:00
|
|
|
2.1.0
|
2014-07-21 20:46:54 +00:00
|
|
|
|