From d8b6742543b6cb493c30caf73b2adc63a408cf0c Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Tue, 2 Oct 2012 02:32:52 +1000 Subject: [PATCH] Blocking numeric home names, changing invalid home message --- .../com/earth2me/essentials/commands/Commandsethome.java | 7 +++++-- Essentials/src/messages.properties | 1 + Essentials/src/messages_cs.properties | 1 + Essentials/src/messages_da.properties | 1 + Essentials/src/messages_de.properties | 1 + Essentials/src/messages_en.properties | 1 + Essentials/src/messages_es.properties | 1 + Essentials/src/messages_fi.properties | 1 + Essentials/src/messages_fr.properties | 1 + Essentials/src/messages_it.properties | 1 + Essentials/src/messages_nl.properties | 1 + Essentials/src/messages_pl.properties | 1 + Essentials/src/messages_pt.properties | 1 + Essentials/src/messages_se.properties | 1 + 14 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java index 7ec1ba11d..c97761f8d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java @@ -2,7 +2,9 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import java.util.Locale; +import java.util.regex.Pattern; import org.bukkit.Location; import org.bukkit.Server; @@ -55,9 +57,10 @@ public class Commandsethome extends EssentialsCommand { name = "home"; } - if ("bed".equals(name)) + if ("bed".equals(name) || Util.isInt(name)) { - throw new NotEnoughArgumentsException(); + user.sendMessage(_("invalidHomeName")); + throw new NoChargeException(); } usersHome.setHome(name, location); user.sendMessage(_("homeSet", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ())); diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 37b8f0945..4852f2bef 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index c0bb5a3d0..26e039001 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -460,3 +460,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index e1245de43..9419ad45e 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 205c6f134..90e373b33 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 37b8f0945..4852f2bef 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 78738532d..b3b098d91 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index 97bf0ae36..8dd5343ad 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 242616fbb..7468952a6 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index 042ee1412..91e2e8f27 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 0e8849f34..62be530f1 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index d6dccc753..1a1e73d65 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 9ee14ed91..11a2c1df0 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index 4701d34c2..c7685d6f4 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name