fix item flags

This commit is contained in:
Jake Potrebic
2024-04-27 12:17:58 -07:00
parent 43b52c8d61
commit cdeb62baac
3 changed files with 330 additions and 5 deletions

View File

@@ -192,13 +192,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
})))));
+ // Paper start - support component removals with a custom pgive command
+ final com.mojang.brigadier.tree.CommandNode<net.minecraft.commands.CommandSourceStack> node = net.minecraft.commands.Commands
+ .literal("pgive").requires((commandlistenerwrapper) -> commandlistenerwrapper.hasPermission(2))
+ .literal("pgive").requires((css) -> css.hasPermission(2))
+ .then(net.minecraft.commands.Commands.argument("targets", EntityArgument.players())
+ .then(net.minecraft.commands.Commands.argument("item", new ItemArgument(commandRegistryAccess, true)).executes((commandcontext) -> {
+ return GiveCommand.giveItem((CommandSourceStack) commandcontext.getSource(), ItemArgument.getItem(commandcontext, "item"), EntityArgument.getPlayers(commandcontext, "targets"), 1);
+ .then(net.minecraft.commands.Commands.argument("item", new ItemArgument(commandRegistryAccess, true)).executes((ctx) -> {
+ return GiveCommand.giveItem(ctx.getSource(), ItemArgument.getItem(ctx, "item"), EntityArgument.getPlayers(ctx, "targets"), 1);
+ })
+ .then(net.minecraft.commands.Commands.argument("count", IntegerArgumentType.integer(1)).executes((commandcontext) -> {
+ return GiveCommand.giveItem((CommandSourceStack) commandcontext.getSource(), ItemArgument.getItem(commandcontext, "item"), EntityArgument.getPlayers(commandcontext, "targets"), IntegerArgumentType.getInteger(commandcontext, "count"));
+ .then(net.minecraft.commands.Commands.argument("count", IntegerArgumentType.integer(1)).executes((ctx) -> {
+ return GiveCommand.giveItem(ctx.getSource(), ItemArgument.getItem(ctx, "item"), EntityArgument.getPlayers(ctx, "targets"), IntegerArgumentType.getInteger(ctx, "count"));
+ }))
+ )
+ ).build();