So I have this command for my server that is working fine: Code (Text): if (cmd.getName().equalsIgnoreCase("health")) { ItemStack is = new ItemStack(Material.ENCHANTED_BOOK, 1); ItemMeta im = is.getItemMeta(); im.setDisplayName(ChatColor.YELLOW + "Enchanted Book"); EnchantmentStorageMeta eMeta = (EnchantmentStorageMeta) is.getItemMeta(); is.setItemMeta(im); Health healthObject = new Health(); PlayerInventory pi = p.getInventory(); EnchantmentAPI.getEnchantments(healthObject.addToItem(is, 1)); pi.addItem(is); Does anyone know how I would add this item to ArchonCrates so that people can have a chance at winning this? It's basically a book, and when you put it on armor, it gives you extra hearts.
Can that plugin execute commands? I haven't used it. If it can you should just be able to make it execute /health as the player or something
Well I don't know either, I make plugins, I don't configure them. This should probably be in Spigot Plugin Help tbh
If it can execute commands it should have some sort of placeholders created that would replace for example the player name. If it's that you should be able to have it execute /health %player%
I guess a better question would be how to put the book in the crate. When players left click the crate, it brings up a list of prizes and their chance, so I don't know how to add this book into the crate. Because the ids would be the same.
Yes. This is my command so far: Code (Text): public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (!(sender instanceof Player)) { return true; } Player p = (Player) sender; if (cmd.getName().equalsIgnoreCase("health")) { ItemStack is = new ItemStack(Material.ENCHANTED_BOOK, 1); ItemMeta im = is.getItemMeta(); im.setDisplayName(ChatColor.YELLOW + "Enchanted Book"); EnchantmentStorageMeta eMeta = (EnchantmentStorageMeta) is.getItemMeta(); is.setItemMeta(im); Health healthObject = new Health(); EnchantmentAPI.getEnchantments(healthObject.addToItem(is, 1)); Player target = Bukkit.getServer().getPlayer(args[0]); if (target == null) { p.sendMessage(ChatColor.RED + "You must specify a player."); return true; } else { target.getInventory().addItem(is); } } return false; } It's giving me an error here: Code (Text): Player target = Bukkit.getServer().getPlayer(args[0]);
No i mean literately adding that item into the config for ArchonCrates. Also you are not checking if args.length is 1 so you will get a error
I figured out how to make the command. When I type /health bmac20, it gives bmac20 the book. But in the ArchonCrates config I have "health <player>" I don't need slashes btw.