2013-10-24 18:23:24 +08:00
|
|
|
From 970b4ae4d7f0ed9c3114609d2c6a56b1dd041071 Mon Sep 17 00:00:00 2001
|
2013-06-21 17:22:15 +08:00
|
|
|
From: md_5 <md_5@live.com.au>
|
|
|
|
Date: Fri, 21 Jun 2013 19:21:58 +1000
|
|
|
|
Subject: [PATCH] Configurable Messages
|
|
|
|
|
|
|
|
|
2013-08-03 16:58:44 +08:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java
|
2013-09-21 11:39:32 +08:00
|
|
|
index d83d475..2b1df38 100644
|
2013-08-03 16:58:44 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/PendingConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PendingConnection.java
|
2013-09-21 11:39:32 +08:00
|
|
|
@@ -80,9 +80,9 @@ public class PendingConnection extends Connection {
|
2013-08-03 16:58:44 +08:00
|
|
|
|
2013-09-20 09:46:45 +08:00
|
|
|
if (packet2handshake.d() != 78) {
|
|
|
|
if (packet2handshake.d() > 78) {
|
|
|
|
- this.disconnect("Outdated server!");
|
|
|
|
+ this.disconnect(org.spigotmc.SpigotConfig.outdatedServerMessage); // Spigot
|
|
|
|
} else {
|
|
|
|
- this.disconnect("Outdated client!");
|
|
|
|
+ this.disconnect(org.spigotmc.SpigotConfig.outdatedClientMessage); // Spigot
|
|
|
|
}
|
2013-08-03 16:58:44 +08:00
|
|
|
} else {
|
2013-09-20 09:46:45 +08:00
|
|
|
this.loginKey = this.server.getOnlineMode() ? Long.toString(random.nextLong(), 16) : "-";
|
2013-06-21 17:22:15 +08:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
2013-09-12 08:17:46 +08:00
|
|
|
index a85157b..e5a259d 100644
|
2013-06-21 17:22:15 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
2013-09-12 08:17:46 +08:00
|
|
|
@@ -310,7 +310,7 @@ public abstract class PlayerList {
|
2013-06-21 17:22:15 +08:00
|
|
|
|
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s1);
|
|
|
|
} else if (!this.isWhitelisted(s)) {
|
|
|
|
- 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
|
|
|
|
} else {
|
|
|
|
String s2 = socketaddress.toString();
|
|
|
|
|
2013-09-12 08:17:46 +08:00
|
|
|
@@ -326,7 +326,7 @@ public abstract class PlayerList {
|
2013-06-23 09:06:30 +08:00
|
|
|
|
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s3);
|
|
|
|
} else if (this.players.size() >= this.maxPlayers) {
|
|
|
|
- event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!");
|
|
|
|
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot
|
|
|
|
} else {
|
|
|
|
event.disallow(PlayerLoginEvent.Result.ALLOWED, s2);
|
|
|
|
}
|
2013-06-21 17:22:15 +08:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2013-10-24 18:23:24 +08:00
|
|
|
index 0d7b044..20719f7 100644
|
2013-06-21 17:22:15 +08:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2013-10-24 18:23:24 +08:00
|
|
|
@@ -533,11 +533,7 @@ public final class CraftServer implements Server {
|
2013-06-21 17:22:15 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-08-03 16:45:50 +08:00
|
|
|
- if (sender instanceof Player) {
|
|
|
|
- sender.sendMessage("Unknown command. Type \"/help\" for help.");
|
|
|
|
- } else {
|
|
|
|
- sender.sendMessage("Unknown command. Type \"help\" for help.");
|
|
|
|
- }
|
2013-06-21 17:22:15 +08:00
|
|
|
+ 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
|
2013-10-16 16:38:15 +08:00
|
|
|
index e146926..1d9d3c9 100644
|
2013-06-21 17:22:15 +08:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
|
|
@@ -15,6 +15,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.file.YamlConfiguration;
|
2013-06-22 12:07:01 +08:00
|
|
|
import org.bukkit.craftbukkit.command.TicksPerSecondCommand;
|
2013-10-16 16:38:15 +08:00
|
|
|
@@ -234,4 +235,22 @@ public class SpigotConfig
|
2013-06-21 17:22:15 +08:00
|
|
|
{
|
|
|
|
tabComplete = getBoolean( "commands.tab-complete", true );
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public static String whitelistMessage;
|
|
|
|
+ public static String unknownCommandMessage;
|
2013-06-23 09:06:30 +08:00
|
|
|
+ public static String serverFullMessage;
|
2013-08-03 16:58:44 +08:00
|
|
|
+ public static String outdatedClientMessage;
|
|
|
|
+ public static String outdatedServerMessage;
|
2013-06-21 17:22:15 +08:00
|
|
|
+ private static String transform(String s)
|
|
|
|
+ {
|
|
|
|
+ return ChatColor.translateAlternateColorCodes( '&', s ).replaceAll( "\\n", "\n" );
|
|
|
|
+ }
|
|
|
|
+ private static void messages()
|
|
|
|
+ {
|
|
|
|
+ whitelistMessage = transform( getString( "messages.whitelist", "You are not whitelisted on this server!" ) );
|
2013-08-03 16:45:50 +08:00
|
|
|
+ unknownCommandMessage = transform( getString( "messages.unknown-command", "Unknown command. Type \"/help\" for help." ) );
|
2013-06-23 09:06:30 +08:00
|
|
|
+ serverFullMessage = transform( getString( "messages.server-full", "The server is full!" ) );
|
2013-08-03 16:58:44 +08:00
|
|
|
+ outdatedClientMessage = transform( getString( "messages.outdated-client", "Outdated client!" ) );
|
|
|
|
+ outdatedServerMessage = transform( getString( "messages.outdated-server", "Outdated server!" ) );
|
2013-06-21 17:22:15 +08:00
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
2013-10-24 18:23:24 +08:00
|
|
|
1.8.3.2
|
2013-06-21 17:22:15 +08:00
|
|
|
|