Print help on invalid arg

Dieser Commit ist enthalten in:
Jesse Boyd 2019-11-14 17:24:10 +00:00
Ursprung 8812e1b60c
Commit 1071e7c226
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F

Datei anzeigen

@ -107,6 +107,7 @@ import com.sk89q.worldedit.command.argument.ZonedDateTimeConverter;
import com.sk89q.worldedit.command.util.CommandPermissions; import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandQueuedCondition; import com.sk89q.worldedit.command.util.CommandQueuedCondition;
import com.sk89q.worldedit.command.util.PermissionCondition; import com.sk89q.worldedit.command.util.PermissionCondition;
import com.sk89q.worldedit.command.util.PrintCommandHelp;
import com.sk89q.worldedit.command.util.SubCommandPermissionCondition; import com.sk89q.worldedit.command.util.SubCommandPermissionCondition;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
@ -704,7 +705,6 @@ public final class PlatformCommandManager {
exceptionConverter.convert(next); exceptionConverter.convert(next);
next = next.getCause(); next = next.getCause();
} while (next != null); } while (next != null);
throw t; throw t;
} }
} catch (ConditionFailedException e) { } catch (ConditionFailedException e) {
@ -734,6 +734,8 @@ public final class PlatformCommandManager {
.color(TextColor.RED) .color(TextColor.RED)
.append(e.getRichMessage()) .append(e.getRichMessage())
.build()); .build());
List<String> argList = parseArgs(event.getArguments()).map(Substring::getSubstring).collect(Collectors.toList());
printUsage(actor, argList);
} catch (Throwable t) { } catch (Throwable t) {
handleUnknownException(actor, t); handleUnknownException(actor, t);
} finally { } finally {
@ -775,6 +777,11 @@ public final class PlatformCommandManager {
event.setCancelled(true); event.setCancelled(true);
} }
private void printUsage(Actor actor, List<String> arguments) {
PrintCommandHelp.help(arguments, 0, false,
getCommandManager(), actor, "//help");
}
private MemoizingValueAccess initializeInjectedValues(Arguments arguments, Actor tmp) { private MemoizingValueAccess initializeInjectedValues(Arguments arguments, Actor tmp) {
InjectedValueStore store = MapBackedValueStore.create(); InjectedValueStore store = MapBackedValueStore.create();
Actor actor = wrapActor(tmp, store); Actor actor = wrapActor(tmp, store);