mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-23 10:35:15 +01:00
Allow metadata ID to be used in shop creation permission
This commit is contained in:
parent
9f84ca8551
commit
080597c515
@ -42,6 +42,13 @@ public class PermissionChecker implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String matID = item.getType().toString().toLowerCase(Locale.ROOT);
|
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 (PriceUtil.hasBuyPrice(priceLine)) {
|
||||||
if (Permission.has(player, SHOP_CREATION_BUY_ID + matID)) {
|
if (Permission.has(player, SHOP_CREATION_BUY_ID + matID)) {
|
||||||
return;
|
return;
|
||||||
|
@ -71,7 +71,7 @@ public enum Permission {
|
|||||||
return has(player, base + "." + name) || has(player, base + "." + name.toLowerCase(Locale.ROOT));
|
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))
|
return (sender.isPermissionSet(permission) && !sender.hasPermission(permission))
|
||||||
|| (sender.isPermissionSet(permission.toLowerCase(Locale.ROOT)) && !sender.hasPermission(permission.toLowerCase(Locale.ROOT)));
|
|| (sender.isPermissionSet(permission.toLowerCase(Locale.ROOT)) && !sender.hasPermission(permission.toLowerCase(Locale.ROOT)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user