use of net.minecraft.command.EntitySelector in project ArmorStandEditor by Patbox.
the class GeneralCommands method giveTool.
private static int giveTool(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
ItemStack itemStack = ConfigManager.getConfig().armorStandTool.getDefaultStack();
itemStack.getOrCreateTag().putBoolean("isArmorStandEditor", true);
EntitySelector entitySelector = context.getArgument("targets", EntitySelector.class);
for (ServerPlayerEntity player : entitySelector.getPlayers(context.getSource())) {
player.inventory.offerOrDrop(player.world, itemStack);
context.getSource().sendFeedback(new TranslatableText("armorstandeditor.command.give", player.getDisplayName()), true);
}
return 1;
}
Aggregations