mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-14 04:01:59 +01:00
Adding essentials.delhome.others to allow people to delete other peoples homes.
This commit is contained in:
parent
3d913f9fcc
commit
016dd10060
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user