2013-07-02 05:14:02 +00:00
|
|
|
From 9630657d94dc1b99321e2c7ed729d386c1bc1286 Mon Sep 17 00:00:00 2001
|
2013-06-21 09:22:15 +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/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
2013-07-02 03:14:40 +00:00
|
|
|
index 1276ec4..cbe823f 100644
|
2013-06-21 09:22:15 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
@@ -307,7 +307,7 @@ public abstract class PlayerList {
|
|
|
|
|
|
|
|
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-06-23 01:06:30 +00:00
|
|
|
@@ -323,7 +323,7 @@ public abstract class PlayerList {
|
|
|
|
|
|
|
|
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 09:22:15 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2013-07-01 23:08:07 +00:00
|
|
|
index def0519..58da9cb 100644
|
2013-06-21 09:22:15 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2013-06-22 04:07:01 +00:00
|
|
|
@@ -526,7 +526,7 @@ public final class CraftServer implements Server {
|
2013-06-21 09:22:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
- 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
|
2013-07-02 05:14:02 +00:00
|
|
|
index fff8c02..d2058f3 100644
|
2013-06-21 09:22:15 +00: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 04:07:01 +00:00
|
|
|
import org.bukkit.craftbukkit.command.TicksPerSecondCommand;
|
2013-07-02 05:14:02 +00:00
|
|
|
@@ -240,4 +241,18 @@ public class SpigotConfig
|
2013-06-21 09:22:15 +00:00
|
|
|
{
|
|
|
|
tabComplete = getBoolean( "commands.tab-complete", true );
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public static String whitelistMessage;
|
|
|
|
+ public static String unknownCommandMessage;
|
2013-06-23 01:06:30 +00:00
|
|
|
+ public static String serverFullMessage;
|
2013-06-21 09:22:15 +00: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!" ) );
|
|
|
|
+ unknownCommandMessage = transform( getString( "messages.unknown-command", "Unknown command. Type \"help\" for help." ) );
|
2013-06-23 01:06:30 +00:00
|
|
|
+ serverFullMessage = transform( getString( "messages.server-full", "The server is full!" ) );
|
2013-06-21 09:22:15 +00:00
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
|
|
|
1.8.1.2
|
|
|
|
|