Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/CraftBukkit-Patches/0049-Configurable-Messages.patch

100 Zeilen
4.7 KiB
Diff

From 3038b2cfba13c9f0bad651f6097d123ab7b02da7 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/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java
index d83d475..2b1df38 100644
--- a/src/main/java/net/minecraft/server/PendingConnection.java
+++ b/src/main/java/net/minecraft/server/PendingConnection.java
@@ -80,9 +80,9 @@ public class PendingConnection extends Connection {
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
}
} else {
this.loginKey = this.server.getOnlineMode() ? Long.toString(random.nextLong(), 16) : "-";
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index a85157b..e5a259d 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -310,7 +310,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();
@@ -326,7 +326,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);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0fa69ea..404a626 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -528,11 +528,7 @@ public final class CraftServer implements Server {
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
index 85369ed..53c66fc 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.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.command.TicksPerSecondCommand;
@@ -246,4 +247,22 @@ public class SpigotConfig
{
tabComplete = getBoolean( "commands.tab-complete", true );
}
+
+ public static String whitelistMessage;
+ public static String unknownCommandMessage;
+ 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!" ) );
+ 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", "Outdated client!" ) );
+ outdatedServerMessage = transform( getString( "messages.outdated-server", "Outdated server!" ) );
+ }
}
--
1.8.1.2