I'm trying to code it so when a command is sent, you get a stick but has the properties that when right clicked, it will give you regeneration or something. I don't know how to code this so i was wondering if anyone can give me a basic template to work with so that i can edit it later. Thanks!
@R3YGamer You can create a command that gives you a stick with a custom NBT tag, then you can listen to the PlayerInteractEvent and check if the clicked item has that NBT and if so, apply your regeneration.
@R3YGamer This is just an hint that maybe can help you: Code: package org.mandale.tokenseconomy.commands; import java.util.ArrayList; import java.util.List; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; public class StickCommand implements CommandExecutor, Listener{ @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { //Now i'm not spoonfeding so i write only your part (a part of your part? lol) //I'm writing only stick's giving part Player p = (Player) sender; ItemStack item = new ItemStack(Material.STICK); ItemMeta meta = item.getItemMeta(); List<String> lore = new ArrayList<String>(); meta.setDisplayName("Display and ecc"); lore.add("your lore"); meta.setLore(lore); item.setItemMeta(meta); p.getInventory().addItem(item); return false; } @EventHandler public void onClick(PlayerInteractEvent event) { Player p = event.getPlayer(); ItemStack clicked = event.getItem(); //now for this part you can do by yourself //It's easier than it seems! } } P.s Now I advise you to separate the event from the class (I did it because it would have taken too long for me to explain everything)