From 0cf77c3cbcb9ab7118334018d32ecb48f7a40601 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 25 Jun 2017 14:21:56 +1000 Subject: [PATCH] Fixes brush perms check #610 --- .../java/com/boydti/fawe/object/brush/BrushSettings.java | 5 +++-- .../java/com/sk89q/worldedit/command/tool/BrushTool.java | 8 +++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/object/brush/BrushSettings.java b/core/src/main/java/com/boydti/fawe/object/brush/BrushSettings.java index 1ff831f9..24496718 100644 --- a/core/src/main/java/com/boydti/fawe/object/brush/BrushSettings.java +++ b/core/src/main/java/com/boydti/fawe/object/brush/BrushSettings.java @@ -234,10 +234,11 @@ public class BrushSettings { } public boolean canUse(Actor actor) { - for (String perm : getPermissions()) { + Set perms = getPermissions(); + for (String perm : perms) { if (actor.hasPermission(perm)) return true; } - return false; + return perms.isEmpty(); } } diff --git a/core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java b/core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java index 4bd4df9c..cf641b80 100644 --- a/core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java +++ b/core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java @@ -73,9 +73,9 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool private TargetMode targetMode = TargetMode.TARGET_BLOCK_RANGE; private Mask targetMask = null; - private transient BrushSettings context = new BrushSettings(); - private transient BrushSettings primary = context; + private transient BrushSettings primary = new BrushSettings(); private transient BrushSettings secondary = new BrushSettings(); + private transient BrushSettings context = primary; private transient VisualExtent visualExtent; private transient Lock lock = new ReentrantLock(); @@ -392,13 +392,11 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool setContext(primary); break; case SECONDARY: - if (primary == secondary) { - return false; - } setContext(secondary); break; } + BrushSettings current = getContext(); Brush brush = current.getBrush(); if (brush == null) return false;