geforkt von Mirrors/FastAsyncWorldEdit
Add nicer error when using player commands as console.
Also fix slash counts for Bukkit.
Dieser Commit ist enthalten in:
Ursprung
8baf221c95
Commit
3c04a83852
@ -289,7 +289,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
|||||||
// code of WorldEdit expects it
|
// code of WorldEdit expects it
|
||||||
String[] split = new String[args.length + 1];
|
String[] split = new String[args.length + 1];
|
||||||
System.arraycopy(args, 0, split, 1, args.length);
|
System.arraycopy(args, 0, split, 1, args.length);
|
||||||
split[0] = cmd.getName();
|
split[0] = "/" + cmd.getName();
|
||||||
|
|
||||||
CommandEvent event = new CommandEvent(wrapCommandSender(sender), Joiner.on(" ").join(split));
|
CommandEvent event = new CommandEvent(wrapCommandSender(sender), Joiner.on(" ").join(split));
|
||||||
getWorldEdit().getEventBus().post(event);
|
getWorldEdit().getEventBus().post(event);
|
||||||
@ -303,7 +303,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
|||||||
// code of WorldEdit expects it
|
// code of WorldEdit expects it
|
||||||
String[] split = new String[args.length + 1];
|
String[] split = new String[args.length + 1];
|
||||||
System.arraycopy(args, 0, split, 1, args.length);
|
System.arraycopy(args, 0, split, 1, args.length);
|
||||||
split[0] = cmd.getName();
|
split[0] = "/" + cmd.getName();
|
||||||
|
|
||||||
CommandSuggestionEvent event = new CommandSuggestionEvent(wrapCommandSender(sender), Joiner.on(" ").join(split));
|
CommandSuggestionEvent event = new CommandSuggestionEvent(wrapCommandSender(sender), Joiner.on(" ").join(split));
|
||||||
getWorldEdit().getEventBus().post(event);
|
getWorldEdit().getEventBus().post(event);
|
||||||
|
@ -469,6 +469,10 @@ public final class PlatformCommandManager {
|
|||||||
store.injectValue(Key.of(Actor.class), ValueProvider.constant(actor));
|
store.injectValue(Key.of(Actor.class), ValueProvider.constant(actor));
|
||||||
if (actor instanceof Player) {
|
if (actor instanceof Player) {
|
||||||
store.injectValue(Key.of(Player.class), ValueProvider.constant((Player) actor));
|
store.injectValue(Key.of(Player.class), ValueProvider.constant((Player) actor));
|
||||||
|
} else {
|
||||||
|
store.injectValue(Key.of(Player.class), context -> {
|
||||||
|
throw new CommandException(TextComponent.of("This command must be used with a player."), ImmutableList.of());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
store.injectValue(Key.of(Arguments.class), ValueProvider.constant(event::getArguments));
|
store.injectValue(Key.of(Arguments.class), ValueProvider.constant(event::getArguments));
|
||||||
store.injectValue(Key.of(LocalSession.class),
|
store.injectValue(Key.of(LocalSession.class),
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren