Add set "none" command as an alternative to unset

This commit is contained in:
Luck 2016-11-04 16:40:55 +00:00
parent 79f24a5944
commit 385aa6d438
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -196,7 +196,6 @@ public class CommandManager {
return; return;
} }
String s = args.get(2).toLowerCase(); String s = args.get(2).toLowerCase();
switch (s) { switch (s) {
// Provide aliases // Provide aliases
@ -295,6 +294,20 @@ public class CommandManager {
args.add(2, "meta"); args.add(2, "meta");
break; break;
} }
// Provide lazy set rewrite
boolean lazySet = (
args.size() >= 6 &&
args.get(2).equalsIgnoreCase("permission") &&
args.get(3).toLowerCase().startsWith("set") &&
(args.get(5).equalsIgnoreCase("none") || args.get(5).equalsIgnoreCase("0"))
);
if (lazySet) {
args.remove(5);
args.remove(3);
args.add(3, "unset");
}
} }
} }
} }