3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 02:50:05 +01:00

Pass service to brush sub-commands too.

Dieser Commit ist enthalten in:
wizjany 2019-05-09 11:14:10 -04:00
Ursprung c169d8f258
Commit e2e903ca5e
3 geänderte Dateien mit 8 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -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.TranslatableComponent;
import org.enginehub.piston.CommandManager;
import org.enginehub.piston.CommandManagerService;
import org.enginehub.piston.CommandParameters;
import org.enginehub.piston.DefaultCommandManagerService;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
@ -66,13 +66,12 @@ public class ApplyBrushCommands {
.ofTypes(ImmutableList.of(Key.of(double.class)))
.build();
public static void register(CommandManager commandManager, CommandRegistrationHandler registration) {
public static void register(CommandManagerService service, CommandManager commandManager, CommandRegistrationHandler registration) {
commandManager.register("apply", builder -> {
builder.description(TextComponent.of("Apply brush, apply a function to every block"));
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
CommandManager manager = DefaultCommandManagerService.getInstance()
.newCommandManager();
CommandManager manager = service.newCommandManager();
registration.register(
manager,
ApplyBrushCommandsRegistration.builder(),

Datei anzeigen

@ -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.TranslatableComponent;
import org.enginehub.piston.CommandManager;
import org.enginehub.piston.CommandManagerService;
import org.enginehub.piston.CommandParameters;
import org.enginehub.piston.DefaultCommandManagerService;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
@ -71,13 +71,12 @@ public class PaintBrushCommands {
.ofTypes(ImmutableList.of(Key.of(double.class)))
.build();
public static void register(CommandManager commandManager, CommandRegistrationHandler registration) {
public static void register(CommandManagerService service, CommandManager commandManager, CommandRegistrationHandler registration) {
commandManager.register("paint", builder -> {
builder.description(TextComponent.of("Paint brush, apply a function to a surface"));
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
CommandManager manager = DefaultCommandManagerService.getInstance()
.newCommandManager();
CommandManager manager = service.newCommandManager();
registration.register(
manager,
PaintBrushCommandsRegistration.builder(),

Datei anzeigen

@ -104,7 +104,6 @@ import com.sk89q.worldedit.world.World;
import org.enginehub.piston.ColorConfig;
import org.enginehub.piston.Command;
import org.enginehub.piston.CommandManager;
import org.enginehub.piston.DefaultCommandManagerService;
import org.enginehub.piston.converter.ArgumentConverters;
import org.enginehub.piston.exception.CommandException;
import org.enginehub.piston.exception.CommandExecutionException;
@ -300,8 +299,8 @@ public final class PlatformCommandManager {
BrushCommandsRegistration.builder(),
new BrushCommands(worldEdit),
manager -> {
PaintBrushCommands.register(manager, registration);
ApplyBrushCommands.register(manager, registration);
PaintBrushCommands.register(commandManagerService, manager, registration);
ApplyBrushCommands.register(commandManagerService, manager, registration);
}
);
registerSubCommands(