diff options
author | Riaku <riaku56@gmail.com> | 2013-04-04 08:01:02 -0500 |
---|---|---|
committer | Riaku <riaku56@gmail.com> | 2013-04-04 08:03:06 -0500 |
commit | d20aa0504ef13fef52d60caa91f131dc9de760d2 (patch) | |
tree | cc640151961045358f4c18acdd37ddbb8a0f7d2a | |
parent | c78ec4fed2a156685dfc8ac675336135f1d4219a (diff) | |
download | Essentials-d20aa0504ef13fef52d60caa91f131dc9de760d2.tar Essentials-d20aa0504ef13fef52d60caa91f131dc9de760d2.tar.gz Essentials-d20aa0504ef13fef52d60caa91f131dc9de760d2.tar.lz Essentials-d20aa0504ef13fef52d60caa91f131dc9de760d2.tar.xz Essentials-d20aa0504ef13fef52d60caa91f131dc9de760d2.zip |
regex check on banip command format if player name is not found
-rw-r--r-- | Essentials/src/messages.properties | 1 | ||||
-rw-r--r-- | Essentials/src/net/ess3/commands/Commandbanip.java | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index ea55baaf7..45c6a2e41 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -505,5 +505,6 @@ recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2} recipeWhere=\u00a76Where: {0} +invalidIpAddress=\u00a74Invalid IP address #, java-format Hello\ {0},\ how\ are\ you?=\u00a7fHello \u00a74{0}\u00a7f, how are you? diff --git a/Essentials/src/net/ess3/commands/Commandbanip.java b/Essentials/src/net/ess3/commands/Commandbanip.java index a7f66016b..f08d08843 100644 --- a/Essentials/src/net/ess3/commands/Commandbanip.java +++ b/Essentials/src/net/ess3/commands/Commandbanip.java @@ -19,8 +19,15 @@ public class Commandbanip extends EssentialsCommand if (player == null) { - ess.getServer().banIP(args[0]); - sender.sendMessage(_("banIpAddress")); + if(args[0].matches("\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b")) + { + ess.getServer().banIP(args[0]); + sender.sendMessage(_("banIpAddress")); + } + else + { + sender.sendMessage(_("invalidIpAddress")); + } } else { |