summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2011-08-26 05:12:29 +0100
committerKHobbits <rob@khobbits.co.uk>2011-08-26 05:13:38 +0100
commit016dd10060ca19bcf5bfd8d857b12bc34847cbfc (patch)
treeb958790ee7861b9adcd6e14e7d17a0918a10804a
parent3d913f9fcc392e3b04be29417205da9a9d27ee5a (diff)
downloadEssentials-016dd10060ca19bcf5bfd8d857b12bc34847cbfc.tar
Essentials-016dd10060ca19bcf5bfd8d857b12bc34847cbfc.tar.gz
Essentials-016dd10060ca19bcf5bfd8d857b12bc34847cbfc.tar.lz
Essentials-016dd10060ca19bcf5bfd8d857b12bc34847cbfc.tar.xz
Essentials-016dd10060ca19bcf5bfd8d857b12bc34847cbfc.zip
Adding essentials.delhome.others to allow people to delete other peoples homes.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java22
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));
}