mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-20 13:31:25 +02:00
regex check on banip command format if player name is not found
This commit is contained in:
@@ -505,5 +505,6 @@ recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
|
|||||||
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
|
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
|
||||||
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
|
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
|
||||||
recipeWhere=\u00a76Where: {0}
|
recipeWhere=\u00a76Where: {0}
|
||||||
|
invalidIpAddress=\u00a74Invalid IP address
|
||||||
#, java-format
|
#, java-format
|
||||||
Hello\ {0},\ how\ are\ you?=\u00a7fHello \u00a74{0}\u00a7f, how are you?
|
Hello\ {0},\ how\ are\ you?=\u00a7fHello \u00a74{0}\u00a7f, how are you?
|
||||||
|
@@ -18,11 +18,18 @@ public class Commandbanip extends EssentialsCommand
|
|||||||
final IUser player = ess.getUserMap().getUser(args[0]);
|
final IUser player = ess.getUserMap().getUser(args[0]);
|
||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
|
{
|
||||||
|
if(args[0].matches("\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b"))
|
||||||
{
|
{
|
||||||
ess.getServer().banIP(args[0]);
|
ess.getServer().banIP(args[0]);
|
||||||
sender.sendMessage(_("banIpAddress"));
|
sender.sendMessage(_("banIpAddress"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(_("invalidIpAddress"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
final String ipAddress = player.getData().getIpAddress();
|
final String ipAddress = player.getData().getIpAddress();
|
||||||
if (ipAddress.length() == 0)
|
if (ipAddress.length() == 0)
|
||||||
|
Reference in New Issue
Block a user