Fixes brush perms check #610

This commit is contained in:
Jesse Boyd 2017-06-25 14:21:56 +10:00
parent b49a0a35af
commit 0cf77c3cbc
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 6 additions and 7 deletions

View File

@ -234,10 +234,11 @@ public class BrushSettings {
}
public boolean canUse(Actor actor) {
for (String perm : getPermissions()) {
Set<String> perms = getPermissions();
for (String perm : perms) {
if (actor.hasPermission(perm)) return true;
}
return false;
return perms.isEmpty();
}
}

View File

@ -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;