diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java b/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java index 7badbf969..aa60c9168 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java @@ -16,26 +16,32 @@ public class Commanddelhome extends EssentialsCommand @Override public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { - User user; + //Allowing both formats /delhome khobbits house | /delhome khobbits:house + final String[] nameParts = args[0].split(":"); + if (nameParts[0].length() != args[0].length()) + { + args = nameParts; + } + + User user = ess.getUser(sender); String name; if (args.length < 1) { throw new NotEnoughArgumentsException(); } - else if (args.length < 2) + else if (args.length > 1 && (user == null || user.isAuthorized("essentials.delhome.others"))) + { + user = getPlayer(server, args, 0); + name = args[1]; + } + else { - user = ess.getUser(sender); if (user == null) { throw new NotEnoughArgumentsException(); } name = args[0]; } - else - { - user = getPlayer(server, args, 0); - name = args[1]; - } user.delHome(name.toLowerCase()); sender.sendMessage(Util.format("deleteHome", name)); } |