Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean hasSizePermission(Permissible target, long size) {
- if (size <= defaultSize || target.hasPermission("sregionprotector.region.size.*")) return true;
- for (PermissionAttachmentInfo perm : target.getEffectivePermissions().values()) {
- if (!perm.getPermission().startsWith("sregionprotector.region.size.")) continue;
- try {
- long max = Long.parseLong(perm.getPermission().replace("sregionprotector.region.size.", ""));
- if (max >= size) return true;
- } catch (NumberFormatException ignore) {
- }
- }
- return false;
- }
- public boolean hasAmountPermission(Permissible target, int amount) {
- if (amount <= defaultAmount || target.hasPermission("sregionprotector.region.amount.*")) return true;
- for (PermissionAttachmentInfo perm : target.getEffectivePermissions().values()) {
- if (!perm.getPermission().startsWith("sregionprotector.region.amount.")) continue;
- try {
- int max = Integer.parseInt(perm.getPermission().replace("sregionprotector.region.amount.", ""));
- if (max >= amount) return true;
- } catch (NumberFormatException ignore) {
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement