Essentials.sethome.others doesn't imply essentials.sethome.multiple.

Restore essentials.home.others permission check.
This commit is contained in:
KHobbits 2011-08-24 02:48:38 +01:00
parent 6946488e0d
commit 8cc249c2d3
2 changed files with 16 additions and 4 deletions

View File

@ -25,7 +25,7 @@ public class Commandhome extends EssentialsCommand
if (args.length > 0) if (args.length > 0)
{ {
nameParts = args[0].split(":"); 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]; homeName = nameParts[0];
} }

View File

@ -17,12 +17,19 @@ public class Commandsethome extends EssentialsCommand
{ {
if (args.length > 0) 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 (args.length < 2)
{ {
if (user.isAuthorized("essentials.sethome.multiple")) if (user.isAuthorized("essentials.sethome.multiple"))
{ {
if ((user.isAuthorized("essentials.sethome.multiple.unlimited")) || (user.getHomes().size() < ess.getSettings().getMultipleHomes()) 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()); user.setHome(args[0].toLowerCase());
} }
@ -46,7 +53,12 @@ public class Commandsethome extends EssentialsCommand
{ {
throw new Exception(Util.i18n("playerNotFound")); 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());
} }
} }
} }