JS command perms

Dieser Commit ist enthalten in:
Jesse Boyd 2018-08-22 17:12:41 +10:00
Ursprung 4651d5e36b
Commit 9927cde616
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
5 geänderte Dateien mit 18 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -47,4 +47,8 @@ public class CommandLocals {
return locals.put(key, value);
}
public Object putIfAbsent(Object key, Object value) {
return locals.putIfAbsent(key, value);
}
}

Datei anzeigen

@ -13,6 +13,8 @@ import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.command.CallableProcessor;
import com.sk89q.worldedit.util.command.CommandCallable;
import com.sk89q.worldedit.util.command.parametric.AParametricCallable;
public class BrushProcessor extends MethodCommands implements CallableProcessor<BrushSettings> {
private final WorldEdit worldEdit;
@ -55,7 +57,14 @@ public class BrushProcessor extends MethodCommands implements CallableProcessor<
}
}
bs.addPermissions(getPermissions());
CommandCallable callable = locals.get(CommandCallable.class);
String[] perms;
if (callable != null && callable instanceof AParametricCallable) {
perms = ((AParametricCallable) callable).getPermissions();
} else {
perms = getPermissions();
}
bs.addPermissions(perms);
if (locals != null) {
String args = (String) locals.get("arguments");

Datei anzeigen

@ -211,6 +211,7 @@ public class FunctionParametricCallable extends AParametricCallable {
if (!testPermission(locals)) {
throw new CommandPermissionsException();
}
locals.putIfAbsent(CommandCallable.class, this);
String calledCommand = parentCommands.length > 0 ? parentCommands[parentCommands.length - 1] : "_";
String[] split = (calledCommand + " " + stringArguments).split(" ", -1);

Datei anzeigen

@ -197,6 +197,7 @@ public class ParametricCallable extends AParametricCallable {
if (!testPermission(locals)) {
throw new CommandPermissionsException();
}
locals.putIfAbsent(CommandCallable.class, this);
String calledCommand = parentCommands.length > 0 ? parentCommands[parentCommands.length - 1] : "_";
String[] split = (calledCommand + " " + stringArguments).split(" ", -1);

Datei anzeigen

@ -29,6 +29,7 @@
var f = functions[i];
if (f.hasOwnProperty('desc'))
{
if (!f.hasOwnProperty('permission')) f.permission = "fawe.use";
if (!f.hasOwnProperty('aliases')) f.aliases = [f.name];
var cmd = com.boydti.fawe.config.Commands.fromArgs(f.aliases, f.usage, f.desc, f.min, f.max, f.flags, f.help);
var man = com.sk89q.worldedit.extension.platform.CommandManager.getInstance();
@ -41,7 +42,7 @@
}
});
var w2 = new wrap();
var callable = new com.sk89q.worldedit.util.command.parametric.FunctionParametricCallable(builder, "", cmd, "fawe.use", args, w2);
var callable = new com.sk89q.worldedit.util.command.parametric.FunctionParametricCallable(builder, "", cmd, f.permission, args, w2);
commands.add(callable);
}
}