geforkt von Mirrors/FastAsyncWorldEdit
Pass service to brush sub-commands too.
Dieser Commit ist enthalten in:
Ursprung
c169d8f258
Commit
e2e903ca5e
@ -39,8 +39,8 @@ import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import org.enginehub.piston.CommandManager;
|
import org.enginehub.piston.CommandManager;
|
||||||
|
import org.enginehub.piston.CommandManagerService;
|
||||||
import org.enginehub.piston.CommandParameters;
|
import org.enginehub.piston.CommandParameters;
|
||||||
import org.enginehub.piston.DefaultCommandManagerService;
|
|
||||||
import org.enginehub.piston.annotation.Command;
|
import org.enginehub.piston.annotation.Command;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
@ -66,13 +66,12 @@ public class ApplyBrushCommands {
|
|||||||
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static void register(CommandManager commandManager, CommandRegistrationHandler registration) {
|
public static void register(CommandManagerService service, CommandManager commandManager, CommandRegistrationHandler registration) {
|
||||||
commandManager.register("apply", builder -> {
|
commandManager.register("apply", builder -> {
|
||||||
builder.description(TextComponent.of("Apply brush, apply a function to every block"));
|
builder.description(TextComponent.of("Apply brush, apply a function to every block"));
|
||||||
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
|
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
|
||||||
|
|
||||||
CommandManager manager = DefaultCommandManagerService.getInstance()
|
CommandManager manager = service.newCommandManager();
|
||||||
.newCommandManager();
|
|
||||||
registration.register(
|
registration.register(
|
||||||
manager,
|
manager,
|
||||||
ApplyBrushCommandsRegistration.builder(),
|
ApplyBrushCommandsRegistration.builder(),
|
||||||
|
@ -39,8 +39,8 @@ import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import org.enginehub.piston.CommandManager;
|
import org.enginehub.piston.CommandManager;
|
||||||
|
import org.enginehub.piston.CommandManagerService;
|
||||||
import org.enginehub.piston.CommandParameters;
|
import org.enginehub.piston.CommandParameters;
|
||||||
import org.enginehub.piston.DefaultCommandManagerService;
|
|
||||||
import org.enginehub.piston.annotation.Command;
|
import org.enginehub.piston.annotation.Command;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
@ -71,13 +71,12 @@ public class PaintBrushCommands {
|
|||||||
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static void register(CommandManager commandManager, CommandRegistrationHandler registration) {
|
public static void register(CommandManagerService service, CommandManager commandManager, CommandRegistrationHandler registration) {
|
||||||
commandManager.register("paint", builder -> {
|
commandManager.register("paint", builder -> {
|
||||||
builder.description(TextComponent.of("Paint brush, apply a function to a surface"));
|
builder.description(TextComponent.of("Paint brush, apply a function to a surface"));
|
||||||
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
|
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
|
||||||
|
|
||||||
CommandManager manager = DefaultCommandManagerService.getInstance()
|
CommandManager manager = service.newCommandManager();
|
||||||
.newCommandManager();
|
|
||||||
registration.register(
|
registration.register(
|
||||||
manager,
|
manager,
|
||||||
PaintBrushCommandsRegistration.builder(),
|
PaintBrushCommandsRegistration.builder(),
|
||||||
|
@ -104,7 +104,6 @@ import com.sk89q.worldedit.world.World;
|
|||||||
import org.enginehub.piston.ColorConfig;
|
import org.enginehub.piston.ColorConfig;
|
||||||
import org.enginehub.piston.Command;
|
import org.enginehub.piston.Command;
|
||||||
import org.enginehub.piston.CommandManager;
|
import org.enginehub.piston.CommandManager;
|
||||||
import org.enginehub.piston.DefaultCommandManagerService;
|
|
||||||
import org.enginehub.piston.converter.ArgumentConverters;
|
import org.enginehub.piston.converter.ArgumentConverters;
|
||||||
import org.enginehub.piston.exception.CommandException;
|
import org.enginehub.piston.exception.CommandException;
|
||||||
import org.enginehub.piston.exception.CommandExecutionException;
|
import org.enginehub.piston.exception.CommandExecutionException;
|
||||||
@ -300,8 +299,8 @@ public final class PlatformCommandManager {
|
|||||||
BrushCommandsRegistration.builder(),
|
BrushCommandsRegistration.builder(),
|
||||||
new BrushCommands(worldEdit),
|
new BrushCommands(worldEdit),
|
||||||
manager -> {
|
manager -> {
|
||||||
PaintBrushCommands.register(manager, registration);
|
PaintBrushCommands.register(commandManagerService, manager, registration);
|
||||||
ApplyBrushCommands.register(manager, registration);
|
ApplyBrushCommands.register(commandManagerService, manager, registration);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
registerSubCommands(
|
registerSubCommands(
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren