First attempt at integrating Piston as the only command system

This commit is contained in:
Kenzie Togami
2019-04-15 01:21:15 -07:00
parent da35b3c174
commit 267ccf2298
28 changed files with 493 additions and 389 deletions

View File

@ -19,8 +19,9 @@
package com.sk89q.worldedit.util.command.parametric;
import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.WrappedCommandException;
import org.enginehub.piston.exception.CommandException;
import org.enginehub.piston.exception.CommandExecutionException;
/**
* Used to convert a recognized {@link Throwable} into an appropriate
@ -29,7 +30,7 @@ import com.sk89q.minecraft.util.commands.WrappedCommandException;
* <p>Methods (when invoked by a {@link ParametricBuilder}-created command) may throw
* relevant exceptions that are not caught by the command manager, but translate
* into reasonable exceptions for an application. However, unknown exceptions are
* normally simply wrapped in a {@link WrappedCommandException} and bubbled up. Only
* normally simply wrapped in a {@link CommandExecutionException} and bubbled up. Only
* normal {@link CommandException}s will be printed correctly, so a converter translates
* one of these unknown exceptions into an appropriate {@link CommandException}.</p>
*

View File

@ -19,8 +19,9 @@
package com.sk89q.worldedit.util.command.parametric;
import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.WrappedCommandException;
import org.enginehub.piston.exception.CommandException;
import org.enginehub.piston.exception.CommandExecutionException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -75,9 +76,9 @@ public abstract class ExceptionConverterHelper implements ExceptionConverter {
if (e.getCause() instanceof CommandException) {
throw (CommandException) e.getCause();
}
throw new WrappedCommandException(e);
throw new CommandExecutionException(e, null);
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new WrappedCommandException(e);
throw new CommandExecutionException(e, null);
}
}
}

View File

@ -22,7 +22,7 @@ package com.sk89q.worldedit.util.formatting.component;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.minecraft.util.commands.CommandLocals;
import com.sk89q.worldedit.extension.platform.CommandManager;
import com.sk89q.worldedit.extension.platform.PlatformCommandMananger;
import com.sk89q.worldedit.util.command.CommandCallable;
import com.sk89q.worldedit.util.command.CommandMapping;
import com.sk89q.worldedit.util.command.Description;
@ -72,7 +72,7 @@ public class CommandUsageBox extends StyledFragment {
String prefix = !commandString.isEmpty() ? commandString + " " : "";
List<CommandMapping> list = new ArrayList<>(dispatcher.getCommands());
list.sort(new PrimaryAliasComparator(CommandManager.COMMAND_CLEAN_PATTERN));
list.sort(new PrimaryAliasComparator(PlatformCommandMananger.COMMAND_CLEAN_PATTERN));
for (CommandMapping mapping : list) {
if (locals == null || mapping.getCallable().testPermission(locals)) {