🐛 Fix argument flags

This commit is contained in:
Alexander Söderberg 2020-10-07 23:28:56 +02:00
parent 2bad5759c6
commit 63dce244aa
No known key found for this signature in database
GPG key ID: FACEA5B0F4C1BF80
4 changed files with 29 additions and 1 deletions

View file

@ -38,6 +38,8 @@ import cloud.commandframework.annotations.specifier.Greedy;
import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ParserParameters;
import cloud.commandframework.arguments.parser.StandardParameters;
import cloud.commandframework.arguments.standard.EnumArgument;
import cloud.commandframework.arguments.standard.IntegerArgument;
import cloud.commandframework.bukkit.BukkitCommandManager;
import cloud.commandframework.bukkit.BukkitCommandMetaBuilder;
import cloud.commandframework.bukkit.CloudBukkitCapabilities;
@ -254,6 +256,17 @@ public final class ExamplePlugin extends JavaPlugin {
})
.execute(() -> context.getSender().sendMessage("DONE!"))
));
manager.command(manager.commandBuilder("give")
.senderType(Player.class)
.argument(EnumArgument.of(Material.class, "material"))
.argument(IntegerArgument.of("amount"))
.handler(c -> {
final Material material = c.get("material");
final int amount = c.get("amount");
final ItemStack itemStack = new ItemStack(material, amount);
((Player) c.getSender()).getInventory().addItem(itemStack);
c.getSender().sendMessage("You've been given stuff, bro.");
}));
}
@CommandMethod("example help [query]")

View file

@ -2,3 +2,4 @@ name: ExamplePlugin
version: 1.0.0
api-version: 1.13
main: cloud.commandframework.examples.bukkit.ExamplePlugin
depends: [Essentials]