More custom messages.

This commit is contained in:
md_5 2013-12-01 18:40:51 +11:00
parent 41d2c0bceb
commit 341a7b2f60
3 changed files with 41 additions and 17 deletions

View File

@ -1,11 +1,29 @@
From 53374efe82a99cd366b4b3b88be0cc4fc0f2baae Mon Sep 17 00:00:00 2001 From 51a2f67232f5e9757f296696e04c30b5ecf4de22 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 19:21:58 +1000 Date: Fri, 21 Jun 2013 19:21:58 +1000
Subject: [PATCH] Configurable Messages 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 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 {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 5b12cb4..3ddf3ae 100644 index 196ac4f..b10b9a7 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java --- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -335,7 +335,7 @@ public abstract class PlayerList { @@ -335,7 +335,7 @@ public abstract class PlayerList {
@ -44,7 +62,7 @@ index 5178808..82a566d 100644
return false; return false;
} }
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 3cdd6ac..a3ddb99 100644 index 3cdd6ac..2420570 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -12,6 +12,7 @@ import java.util.Map; @@ -12,6 +12,7 @@ import java.util.Map;
@ -55,7 +73,7 @@ index 3cdd6ac..a3ddb99 100644
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.command.TicksPerSecondCommand; import org.bukkit.craftbukkit.command.TicksPerSecondCommand;
@@ -148,4 +149,22 @@ public class SpigotConfig @@ -148,4 +149,28 @@ public class SpigotConfig
{ {
tabComplete = getBoolean( "commands.tab-complete", true ); tabComplete = getBoolean( "commands.tab-complete", true );
} }
@ -63,19 +81,25 @@ index 3cdd6ac..a3ddb99 100644
+ public static String whitelistMessage; + public static String whitelistMessage;
+ public static String unknownCommandMessage; + public static String unknownCommandMessage;
+ public static String serverFullMessage; + public static String serverFullMessage;
+ public static String outdatedClientMessage; + public static String outdatedClientMessage = "Outdated client! Please use {}";
+ public static String outdatedServerMessage; + public static String outdatedServerMessage = "Outdated server! I\'m still on {0}";
+ private static String transform(String s) + private static String transform(String s)
+ { + {
+ return ChatColor.translateAlternateColorCodes( '&', s ).replaceAll( "\\n", "\n" ); + return ChatColor.translateAlternateColorCodes( '&', s ).replaceAll( "\\n", "\n" );
+ } + }
+ private static void messages() + private static void messages()
+ { + {
+ if (version < 4)
+ {
+ set( "messages.outdated-client", outdatedClientMessage );
+ set( "messages.outdated-server", outdatedServerMessage );
+ }
+
+ whitelistMessage = transform( getString( "messages.whitelist", "You are not whitelisted on this server!" ) ); + whitelistMessage = transform( getString( "messages.whitelist", "You are not whitelisted on this server!" ) );
+ unknownCommandMessage = transform( getString( "messages.unknown-command", "Unknown command. Type \"/help\" for help." ) ); + unknownCommandMessage = transform( getString( "messages.unknown-command", "Unknown command. Type \"/help\" for help." ) );
+ serverFullMessage = transform( getString( "messages.server-full", "The server is full!" ) ); + serverFullMessage = transform( getString( "messages.server-full", "The server is full!" ) );
+ outdatedClientMessage = transform( getString( "messages.outdated-client", "Outdated client!" ) ); + outdatedClientMessage = transform( getString( "messages.outdated-client", outdatedClientMessage ) );
+ outdatedServerMessage = transform( getString( "messages.outdated-server", "Outdated server!" ) ); + outdatedServerMessage = transform( getString( "messages.outdated-server", outdatedServerMessage ) );
+ } + }
} }
-- --

View File

@ -1,4 +1,4 @@
From 5274d4541b5da2b6007256ad45181b01811bd1ff Mon Sep 17 00:00:00 2001 From eadd3fcab95283fb5fbb04d480f89fcdf7517b7d Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sat, 23 Feb 2013 12:33:20 +1100 Date: Sat, 23 Feb 2013 12:33:20 +1100
Subject: [PATCH] Watchdog Thread. Subject: [PATCH] Watchdog Thread.
@ -144,12 +144,12 @@ index 0000000..a8840c9
+ } + }
+} +}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index a3ddb99..98217ac 100644 index 2420570..3039634 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -167,4 +167,18 @@ public class SpigotConfig @@ -173,4 +173,18 @@ public class SpigotConfig
outdatedClientMessage = transform( getString( "messages.outdated-client", "Outdated client!" ) ); outdatedClientMessage = transform( getString( "messages.outdated-client", outdatedClientMessage ) );
outdatedServerMessage = transform( getString( "messages.outdated-server", "Outdated server!" ) ); outdatedServerMessage = transform( getString( "messages.outdated-server", outdatedServerMessage ) );
} }
+ +
+ public static int timeoutTime = 60; + public static int timeoutTime = 60;

View File

@ -1,4 +1,4 @@
From 5e0ba30b2c5e18f126fd2104c5ff41006ed66a19 Mon Sep 17 00:00:00 2001 From 387cede90c77456c0dce2acc0e214b05a24759ff Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sun, 1 Dec 2013 18:18:41 +1100 Date: Sun, 1 Dec 2013 18:18:41 +1100
Subject: [PATCH] BungeeCord Support Subject: [PATCH] BungeeCord Support
@ -6,7 +6,7 @@ Subject: [PATCH] BungeeCord Support
Provides support for IP forwarding via BungeeCord. Provides support for IP forwarding via BungeeCord.
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index b7f6775..8ab067c 100644 index b96e2ef..251e510 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java --- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -28,6 +28,15 @@ public class HandshakeListener implements PacketHandshakingInListener { @@ -28,6 +28,15 @@ public class HandshakeListener implements PacketHandshakingInListener {
@ -39,10 +39,10 @@ index 8f829bb..42e6311 100644
private EnumProtocol n; private EnumProtocol n;
private IChatBaseComponent o; private IChatBaseComponent o;
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 98217ac..cde6fd6 100644 index 3039634..ca393d0 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -181,4 +181,9 @@ public class SpigotConfig @@ -187,4 +187,9 @@ public class SpigotConfig
commands.put( "restart", new RestartCommand( "restart" ) ); commands.put( "restart", new RestartCommand( "restart" ) );
WatchdogThread.doStart( timeoutTime, restartOnCrash ); WatchdogThread.doStart( timeoutTime, restartOnCrash );
} }