Search in sources :

Example 6 with PermissionCondition

use of com.sk89q.worldedit.command.util.PermissionCondition in project FastAsyncWorldEdit by IntellectualSites.

the class PaintBrushCommands method register.

public static void register(CommandManagerService service, CommandManager commandManager, CommandRegistrationHandler registration) {
    commandManager.register("paint", builder -> {
        builder.description(Caption.of("worldedit.brush.paint.description"));
        builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
        CommandManager manager = service.newCommandManager();
        registration.register(manager, PaintBrushCommandsRegistration.builder(), new PaintBrushCommands());
        builder.condition(new PermissionCondition(ImmutableSet.of("worldedit.brush.paint")));
        builder.addParts(REGION_FACTORY, RADIUS, DENSITY);
        builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type"), Caption.of("worldedit.brush.paint.type")).withCommands(manager.getAllCommands().collect(Collectors.toList())).required().build());
    });
}
Also used : CommandManager(org.enginehub.piston.CommandManager) PermissionCondition(com.sk89q.worldedit.command.util.PermissionCondition)

Aggregations

PermissionCondition (com.sk89q.worldedit.command.util.PermissionCondition)6 SubCommandPermissionCondition (com.sk89q.worldedit.command.util.SubCommandPermissionCondition)3 CommandManager (org.enginehub.piston.CommandManager)3 Substring (com.sk89q.worldedit.internal.util.Substring)2 Subscribe (com.sk89q.worldedit.util.eventbus.Subscribe)2 ArrayList (java.util.ArrayList)2 Command (org.enginehub.piston.Command)2 CommandException (org.enginehub.piston.exception.CommandException)2 ConditionFailedException (org.enginehub.piston.exception.ConditionFailedException)2 MemoizingValueAccess (org.enginehub.piston.inject.MemoizingValueAccess)2 FaweException (com.fastasyncworldedit.core.internal.exception.FaweException)1 ImmutableList (com.google.common.collect.ImmutableList)1 EditSession (com.sk89q.worldedit.EditSession)1 InputParseException (com.sk89q.worldedit.extension.input.InputParseException)1 SessionKey (com.sk89q.worldedit.session.SessionKey)1 Component (com.sk89q.worldedit.util.formatting.text.Component)1 TextComponent (com.sk89q.worldedit.util.formatting.text.TextComponent)1 List (java.util.List)1 CommandExecutionException (org.enginehub.piston.exception.CommandExecutionException)1 UsageException (org.enginehub.piston.exception.UsageException)1