testserver/CraftBukkit-Patches/0041-Configurable-Messages....

84 lines
3.9 KiB
Diff
Raw Normal View History

2013-12-01 03:40:53 +00:00
From 53374efe82a99cd366b4b3b88be0cc4fc0f2baae Mon Sep 17 00:00:00 2001
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-12-01 03:40:53 +00:00
index 5b12cb4..3ddf3ae 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
2013-12-01 03:40:53 +00:00
@@ -335,7 +335,7 @@ public abstract class PlayerList {
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s);
} else if (!this.isWhitelisted(gameprofile.getName())) {
// 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
} else {
2013-12-01 03:40:53 +00:00
String s1 = socketaddress.toString();
2013-12-01 03:40:53 +00:00
@@ -354,7 +354,7 @@ public abstract class PlayerList {
2013-06-23 01:06:30 +00:00
} else {
2013-12-01 03:40:53 +00:00
// return this.players.size() >= this.maxPlayers ? "The server is full!" : null;
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
}
2013-06-23 01:06:30 +00:00
}
2013-12-01 03:40:53 +00:00
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2013-12-01 03:40:53 +00:00
index 5178808..82a566d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2013-12-01 03:40:53 +00:00
@@ -548,11 +548,7 @@ public final class CraftServer implements Server {
return true;
}
2013-08-03 08:45:50 +00:00
- 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
2013-12-01 03:40:53 +00:00
index 3cdd6ac..a3ddb99 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
2013-12-01 03:40:53 +00:00
@@ -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.file.YamlConfiguration;
import org.bukkit.craftbukkit.command.TicksPerSecondCommand;
2013-12-01 03:40:53 +00:00
@@ -148,4 +149,22 @@ public class SpigotConfig
{
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;
+ public static String outdatedClientMessage;
+ public static String outdatedServerMessage;
+ 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 08:45:50 +00:00
+ 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!" ) );
+ outdatedClientMessage = transform( getString( "messages.outdated-client", "Outdated client!" ) );
+ outdatedServerMessage = transform( getString( "messages.outdated-server", "Outdated server!" ) );
+ }
}
--
2013-10-24 10:23:24 +00:00
1.8.3.2