461353e2cb
This was useful when plugins first started upgrading to uuid because each plugin would implement their own way for grabbing uuid's from mojang. Because none of them shared the result they would quickly hit the limits on the api causing the conversion to either fail or pause for long periods of time. The global api cache was a (very hacky) way to force all plugins to share a cache but caused a few issues with plugins that expected a full implementation of the HTTPURLConnection. Due to the fact that most servers/plugins have updated now it seems to be a good time to remove this as its usefulness mostly has expired.
108 lines
5.5 KiB
Diff
108 lines
5.5 KiB
Diff
From 3e0d4f9c080db7ca0ef0059d6f57c9b8c92a1fe5 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/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
index f8bac48..e036bc6 100644
|
|
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
@@ -62,11 +62,11 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
|
// CraftBukkit end
|
|
|
|
if (packethandshakinginsetprotocol.b() > 47) {
|
|
- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8");
|
|
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage, "1.8" ) ); // Spigot
|
|
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
|
|
this.b.close(chatcomponenttext);
|
|
} else if (packethandshakinginsetprotocol.b() < 47) {
|
|
- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.8");
|
|
+ chatcomponenttext = new ChatComponentText(java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage, "1.8" ) ); // Spigot
|
|
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
|
|
this.b.close(chatcomponenttext);
|
|
} else {
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
|
index 6ce88ca..ee2172d 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
|
@@ -388,7 +388,7 @@ public abstract class PlayerList {
|
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s);
|
|
} else if (!this.isWhitelisted(gameprofile)) {
|
|
// 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 if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
|
|
IpBanEntry ipbanentry = this.l.get(socketaddress);
|
|
|
|
@@ -402,7 +402,7 @@ public abstract class PlayerList {
|
|
} else {
|
|
// 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
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 3c83b5a..18e736a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -628,11 +628,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 0a6ab75..95bb141 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
@@ -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.InvalidConfigurationException;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
@@ -171,4 +172,28 @@ public class SpigotConfig
|
|
}
|
|
tabComplete = getInt( "commands.tab-complete", 0 );
|
|
}
|
|
+
|
|
+ public static String whitelistMessage;
|
|
+ public static String unknownCommandMessage;
|
|
+ public static String serverFullMessage;
|
|
+ public static String outdatedClientMessage = "Outdated client! Please use {0}";
|
|
+ public static String outdatedServerMessage = "Outdated server! I\'m still on {0}";
|
|
+ private static String transform(String s)
|
|
+ {
|
|
+ return ChatColor.translateAlternateColorCodes( '&', s ).replaceAll( "\\n", "\n" );
|
|
+ }
|
|
+ private static void messages()
|
|
+ {
|
|
+ if (version < 8)
|
|
+ {
|
|
+ set( "messages.outdated-client", outdatedClientMessage );
|
|
+ set( "messages.outdated-server", outdatedServerMessage );
|
|
+ }
|
|
+
|
|
+ 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", outdatedClientMessage ) );
|
|
+ outdatedServerMessage = transform( getString( "messages.outdated-server", outdatedServerMessage ) );
|
|
+ }
|
|
}
|
|
--
|
|
2.1.0
|
|
|