mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Allow space as well as : in /delhome
This commit is contained in:
parent
292b7b0546
commit
137b60c5f2
1 changed files with 14 additions and 5 deletions
|
@ -15,7 +15,7 @@ public class Commanddelhome extends EssentialsCommand
|
|||
}
|
||||
|
||||
@Override
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
|
@ -24,7 +24,18 @@ public class Commanddelhome extends EssentialsCommand
|
|||
|
||||
User user = ess.getUser(sender);
|
||||
String name;
|
||||
final String[] expandedArg = args[0].split(":");
|
||||
String[] expandedArg;
|
||||
|
||||
//Allowing both formats /sethome khobbits house | /sethome khobbits:house
|
||||
final String[] nameParts = args[0].split(":");
|
||||
if (nameParts[0].length() != args[0].length())
|
||||
{
|
||||
expandedArg = nameParts;
|
||||
}
|
||||
else
|
||||
{
|
||||
expandedArg = args;
|
||||
}
|
||||
|
||||
if (expandedArg.length > 1 && (user == null || user.isAuthorized("essentials.delhome.others")))
|
||||
{
|
||||
|
@ -41,9 +52,7 @@ public class Commanddelhome extends EssentialsCommand
|
|||
}
|
||||
//TODO: Think up a nice error message
|
||||
/*
|
||||
* if (name.equalsIgnoreCase("bed")) {
|
||||
* throw new Exception("You cannot remove the vanilla home point");
|
||||
* }
|
||||
* if (name.equalsIgnoreCase("bed")) { throw new Exception("You cannot remove the vanilla home point"); }
|
||||
*/
|
||||
user.delHome(name.toLowerCase(Locale.ENGLISH));
|
||||
sender.sendMessage(_("deleteHome", name));
|
||||
|
|
Loading…
Reference in a new issue