2013-12-21 23:05:27 +00:00
|
|
|
From 10a0e39c13eff0e451cd4d144037078a6851c783 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
|
|
|
|
|
|
|
|
|
2013-12-01 07:40:51 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
|
|
index b7f6775..b96e2ef 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
|
|
@@ -19,11 +19,11 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
|
|
|
ChatComponentText chatcomponenttext;
|
|
|
|
|
|
|
|
if (packethandshakinginsetprotocol.d() > 4) {
|
|
|
|
- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.7.2");
|
|
|
|
+ chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedServerMessage ); // Spigot
|
|
|
|
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]);
|
|
|
|
this.b.a((IChatBaseComponent) chatcomponenttext);
|
|
|
|
} else if (packethandshakinginsetprotocol.d() < 4) {
|
|
|
|
- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.7.2");
|
|
|
|
+ chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedClientMessage ); // Spigot
|
|
|
|
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]);
|
|
|
|
this.b.a((IChatBaseComponent) chatcomponenttext);
|
|
|
|
} else {
|
2013-06-21 09:22:15 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
2013-12-13 00:10:33 +00:00
|
|
|
index 1725bba..5174602 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
|
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!";
|
2013-06-21 09:22:15 +00:00
|
|
|
- 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-06-21 09:22:15 +00:00
|
|
|
|
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
|
|
|
}
|
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-12-21 23:05:27 +00:00
|
|
|
index 4d77259..5cd6f7d 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-12-01 20:36:51 +00:00
|
|
|
@@ -547,11 +547,7 @@ public final class CraftServer implements Server {
|
2013-06-21 09:22:15 +00:00
|
|
|
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.");
|
|
|
|
- }
|
2013-06-21 09:22:15 +00:00
|
|
|
+ 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-21 23:05:27 +00:00
|
|
|
index dd842c6..6d0a08e 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
|
2013-12-01 03:40:53 +00:00
|
|
|
@@ -12,6 +12,7 @@ import java.util.Map;
|
2013-06-21 09:22:15 +00:00
|
|
|
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-12-01 07:40:51 +00:00
|
|
|
@@ -148,4 +149,28 @@ 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-12-01 07:40:51 +00:00
|
|
|
+ public static String outdatedClientMessage = "Outdated client! Please use {}";
|
|
|
|
+ public static String outdatedServerMessage = "Outdated server! I\'m still on {0}";
|
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()
|
|
|
|
+ {
|
2013-12-01 07:40:51 +00:00
|
|
|
+ if (version < 4)
|
|
|
|
+ {
|
|
|
|
+ set( "messages.outdated-client", outdatedClientMessage );
|
|
|
|
+ set( "messages.outdated-server", outdatedServerMessage );
|
|
|
|
+ }
|
|
|
|
+
|
2013-06-21 09:22:15 +00:00
|
|
|
+ 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!" ) );
|
2013-12-01 07:40:51 +00:00
|
|
|
+ outdatedClientMessage = transform( getString( "messages.outdated-client", outdatedClientMessage ) );
|
|
|
|
+ outdatedServerMessage = transform( getString( "messages.outdated-server", outdatedServerMessage ) );
|
2013-06-21 09:22:15 +00:00
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
2013-10-24 10:23:24 +00:00
|
|
|
1.8.3.2
|
2013-06-21 09:22:15 +00:00
|
|
|
|