From 8cc249c2d3b871abbc5a2664c69c2a92325b1744 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Wed, 24 Aug 2011 02:48:38 +0100 Subject: [PATCH] Essentials.sethome.others doesn't imply essentials.sethome.multiple. Restore essentials.home.others permission check. --- .../essentials/commands/Commandhome.java | 2 +- .../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()); } } }