Remove ID-based permission checks in /give and /item

This commit is contained in:
md678685 2018-10-15 13:16:10 +01:00
parent 1218c3e226
commit 60c90408e7
2 changed files with 2 additions and 5 deletions

View File

@ -31,10 +31,9 @@ public class Commandgive extends EssentialsCommand {
} }
ItemStack stack = ess.getItemDb().get(args[1]); ItemStack stack = ess.getItemDb().get(args[1]);
int itemId = ess.getItemDb().getLegacyId(stack.getType());
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""); final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
if (sender.isPlayer() && (ess.getSettings().permissionBasedItemSpawn() ? (!ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-all") && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-" + itemname) && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-" + itemId)) : (!ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.exempt") && !ess.getUser(sender.getPlayer()).canSpawnItem(stack.getType())))) { if (sender.isPlayer() && (ess.getSettings().permissionBasedItemSpawn() ? (!ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-all") && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-" + itemname)) : (!ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.exempt") && !ess.getUser(sender.getPlayer()).canSpawnItem(stack.getType())))) {
throw new Exception(tl("cantSpawnItem", itemname)); throw new Exception(tl("cantSpawnItem", itemname));
} }

View File

@ -27,11 +27,9 @@ public class Commanditem extends EssentialsCommand {
} }
ItemStack stack = ess.getItemDb().get(args[0]); ItemStack stack = ess.getItemDb().get(args[0]);
int itemId = ess.getItemDb().getLegacyId(stack.getType());
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""); final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
if (ess.getSettings().permissionBasedItemSpawn() ? (!user.isAuthorized("essentials.itemspawn.item-all") && !user.isAuthorized("essentials.itemspawn.item-" + itemname) && !user.isAuthorized("essentials.itemspawn.item-" + itemId)) : (!user.isAuthorized("essentials.itemspawn.exempt") && !user.canSpawnItem(stack.getType()))) { if (ess.getSettings().permissionBasedItemSpawn() ? (!user.isAuthorized("essentials.itemspawn.item-all") && !user.isAuthorized("essentials.itemspawn.item-" + itemname)) : (!user.isAuthorized("essentials.itemspawn.exempt") && !user.canSpawnItem(stack.getType()))) {
throw new Exception(tl("cantSpawnItem", itemname)); throw new Exception(tl("cantSpawnItem", itemname));
} }
try { try {