diff options
author | KHobbits <rob@khobbits.co.uk> | 2011-08-24 02:48:38 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2011-08-24 02:48:38 +0100 |
commit | 8cc249c2d3b871abbc5a2664c69c2a92325b1744 (patch) | |
tree | 33ea1740b4a1fe0af7299ca95a3491c1b0175d7b | |
parent | 6946488e0d93f58ad3435aace88b73eaf299e039 (diff) | |
download | Essentials-8cc249c2d3b871abbc5a2664c69c2a92325b1744.tar Essentials-8cc249c2d3b871abbc5a2664c69c2a92325b1744.tar.gz Essentials-8cc249c2d3b871abbc5a2664c69c2a92325b1744.tar.lz Essentials-8cc249c2d3b871abbc5a2664c69c2a92325b1744.tar.xz Essentials-8cc249c2d3b871abbc5a2664c69c2a92325b1744.zip |
Essentials.sethome.others doesn't imply essentials.sethome.multiple.
Restore essentials.home.others permission check.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandhome.java | 2 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandsethome.java | 18 |
2 files changed, 16 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index 2b285bfe7..f556ea360 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -25,7 +25,7 @@ public class Commandhome extends EssentialsCommand if (args.length > 0) { nameParts = args[0].split(":"); - if (nameParts[0].length() == args[0].length()) + if (nameParts[0].length() == args[0].length() || !user.isAuthorized("essentials.home.others")) { homeName = nameParts[0]; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java index 594804de0..7f496371f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java @@ -17,16 +17,23 @@ public class Commandsethome extends EssentialsCommand { if (args.length > 0) { + //Allowing both formats /sethome khobbits house | /sethome khobbits:house + final String[] nameParts = args[0].split(":"); + if (nameParts[0].length() != args[0].length()) + { + args = nameParts; + } + if (args.length < 2) { if (user.isAuthorized("essentials.sethome.multiple")) { if ((user.isAuthorized("essentials.sethome.multiple.unlimited")) || (user.getHomes().size() < ess.getSettings().getMultipleHomes()) - || (user.getHomes().contains(args[0].toLowerCase()))) + || (user.getHomes().contains(args[0].toLowerCase()))) { user.setHome(args[0].toLowerCase()); } - else + else { throw new Exception(Util.format("maxHomes", ess.getSettings().getMultipleHomes())); } @@ -46,7 +53,12 @@ public class Commandsethome extends EssentialsCommand { throw new Exception(Util.i18n("playerNotFound")); } - usersHome.setHome(args[1].toLowerCase(), user.getLocation()); + String name = args[1].toLowerCase(); + if (!user.isAuthorized("essentials.sethome.multiple")) + { + name = "home"; + } + usersHome.setHome(name, user.getLocation()); } } } |