Allow metadata ID to be used in shop creation permission

This commit is contained in:
Phoenix616 2020-06-01 22:58:34 +01:00
parent 9f84ca8551
commit 080597c515
2 changed files with 8 additions and 1 deletions

View File

@ -42,6 +42,13 @@ public class PermissionChecker implements Listener {
}
String matID = item.getType().toString().toLowerCase(Locale.ROOT);
String[] parts = itemLine.split("#", 2);
if (parts.length == 2 && Permission.hasPermissionSetFalse(player, SHOP_CREATION_ID + matID + "#" + parts[1])) {
event.setOutcome(NO_PERMISSION);
return;
}
if (PriceUtil.hasBuyPrice(priceLine)) {
if (Permission.has(player, SHOP_CREATION_BUY_ID + matID)) {
return;

View File

@ -71,7 +71,7 @@ public enum Permission {
return has(player, base + "." + name) || has(player, base + "." + name.toLowerCase(Locale.ROOT));
}
private static boolean hasPermissionSetFalse(CommandSender sender, String permission) {
public static boolean hasPermissionSetFalse(CommandSender sender, String permission) {
return (sender.isPermissionSet(permission) && !sender.hasPermission(permission))
|| (sender.isPermissionSet(permission.toLowerCase(Locale.ROOT)) && !sender.hasPermission(permission.toLowerCase(Locale.ROOT)));
}