Advertisement
No4NaMe

Untitled

Feb 10th, 2021
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. public boolean hasSizePermission(Permissible target, long size) {
  2. if (size <= defaultSize || target.hasPermission("sregionprotector.region.size.*")) return true;
  3.  
  4. for (PermissionAttachmentInfo perm : target.getEffectivePermissions().values()) {
  5. if (!perm.getPermission().startsWith("sregionprotector.region.size.")) continue;
  6. try {
  7. long max = Long.parseLong(perm.getPermission().replace("sregionprotector.region.size.", ""));
  8. if (max >= size) return true;
  9. } catch (NumberFormatException ignore) {
  10. }
  11. }
  12. return false;
  13. }
  14.  
  15. public boolean hasAmountPermission(Permissible target, int amount) {
  16. if (amount <= defaultAmount || target.hasPermission("sregionprotector.region.amount.*")) return true;
  17.  
  18. for (PermissionAttachmentInfo perm : target.getEffectivePermissions().values()) {
  19. if (!perm.getPermission().startsWith("sregionprotector.region.amount.")) continue;
  20. try {
  21. int max = Integer.parseInt(perm.getPermission().replace("sregionprotector.region.amount.", ""));
  22. if (max >= amount) return true;
  23. } catch (NumberFormatException ignore) {
  24. }
  25. }
  26. return false;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement