mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-06 12:33:03 +00:00
Essentials.sethome.others doesn't imply essentials.sethome.multiple.
Restore essentials.home.others permission check.
This commit is contained in:
parent
6946488e0d
commit
8cc249c2d3
2 changed files with 16 additions and 4 deletions
|
@ -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];
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,16 +17,23 @@ 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());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("maxHomes", ess.getSettings().getMultipleHomes()));
|
throw new Exception(Util.format("maxHomes", ess.getSettings().getMultipleHomes()));
|
||||||
}
|
}
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue