From 3b5c1d1c8b04317ad7566f55686a9537ddb95e52 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 13 May 2018 10:50:42 +1000 Subject: [PATCH] Don't give default limit if they have another --- core/src/main/java/com/boydti/fawe/config/Settings.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/config/Settings.java b/core/src/main/java/com/boydti/fawe/config/Settings.java index fea11c7f..8eacd932 100644 --- a/core/src/main/java/com/boydti/fawe/config/Settings.java +++ b/core/src/main/java/com/boydti/fawe/config/Settings.java @@ -435,9 +435,13 @@ public class Settings extends Config { } else { limit = new FaweLimit(); } - Collection keys = LIMITS.getSections(); + ArrayList keys = new ArrayList<>(LIMITS.getSections()); + if (keys.remove("default")) keys.add("default"); + + boolean limitFound = false; for (String key : keys) { - if (key.equals("default") || (player != null && player.hasPermission("fawe.limit." + key))) { + if ((player != null && player.hasPermission("fawe.limit." + key)) || (!limitFound && key.equals("default"))) { + limitFound = true; LIMITS newLimit = LIMITS.get(key); limit.MAX_ACTIONS = Math.max(limit.MAX_ACTIONS, newLimit.MAX_ACTIONS != -1 ? newLimit.MAX_ACTIONS : Integer.MAX_VALUE); limit.MAX_CHANGES = Math.max(limit.MAX_CHANGES, newLimit.MAX_CHANGES != -1 ? newLimit.MAX_CHANGES : Integer.MAX_VALUE);