Fix Brigadier suggestions for KeyedWorldArgument

This commit is contained in:
Jason Penilla 2021-08-31 13:51:04 -07:00 committed by Jason
parent 4447ab451f
commit b4492e9bc5
3 changed files with 48 additions and 15 deletions

View file

@ -64,6 +64,7 @@ import cloud.commandframework.minecraft.extras.MinecraftHelp;
import cloud.commandframework.minecraft.extras.RichDescription;
import cloud.commandframework.minecraft.extras.TextColorArgument;
import cloud.commandframework.paper.PaperCommandManager;
import cloud.commandframework.paper.argument.KeyedWorldArgument;
import cloud.commandframework.permission.PredicatePermission;
import cloud.commandframework.tasks.TaskConsumer;
import cloud.commandframework.types.tuples.Pair;
@ -478,6 +479,15 @@ public final class ExamplePlugin extends JavaPlugin {
final ItemStack stack = ctx.get("itemstack");
((Player) ctx.getSender()).getInventory().addItem(stack);
}));
this.manager.command(builder.literal("keyed_world")
.argument(KeyedWorldArgument.of("world"))
.senderType(Player.class)
.handler(ctx -> {
final World world = ctx.get("world");
final Player sender = (Player) ctx.getSender();
this.getServer().getScheduler().runTask(this, () -> sender.teleport(world.getSpawnLocation()));
}));
}
@CommandMethod("example help [query]")