Add a patch to allow configuring and editing some server messages.
This commit is contained in:
parent
9c2abd8b65
commit
a18171d81c
1 changed files with 64 additions and 0 deletions
64
CraftBukkit-Patches/0053-Configurable-Messages.patch
Normal file
64
CraftBukkit-Patches/0053-Configurable-Messages.patch
Normal file
|
@ -0,0 +1,64 @@
|
|||
From 6484c43dc5b08c4317b478c9e86d03c3bb2b43c9 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
|
||||
index fe846af..edeefba 100644
|
||||
--- 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();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 4d030b0..71ce507 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -525,7 +525,7 @@ public final class CraftServer implements Server {
|
||||
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
|
||||
index e91f364..992b9c7 100644
|
||||
--- 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.command.SimpleCommandMap;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -220,4 +221,16 @@ public class SpigotConfig
|
||||
{
|
||||
tabComplete = getBoolean( "commands.tab-complete", true );
|
||||
}
|
||||
+
|
||||
+ public static String whitelistMessage;
|
||||
+ public static String unknownCommandMessage;
|
||||
+ 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." ) );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.8.1.2
|
||||
|
Loading…
Reference in a new issue