Blocking numeric home names, changing invalid home message

This commit is contained in:
Chris Ward 2012-10-02 02:32:52 +10:00
parent d7829bef28
commit d8b6742543
14 changed files with 18 additions and 2 deletions

View file

@ -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()));