Give item not working

Discussion in 'Plugin Development' started by SizGen, Mar 26, 2020.

Thread Status:
Not open for further replies.
  1. Offline


    I'm making a plugin and when someone executes a command it gets a crossbow but it doesn't work.
    package me.sizgen.beewars;
    import org.bukkit.ChatColor;
    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.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    public class HoneygunCommand implements CommandExecutor {
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
                Player player = (Player) sender;
                sender.sendMessage(ChatColor.GOLD + "Je hebt je HoneyGun gekregen!");
                ItemStack item = new ItemStack(Material.CROSSBOW, 1);
                ItemMeta meta = item.getItemMeta();
                meta.setDisplayName(ChatColor.GOLD + "HoneyGun");
                return true;
            return false;
    Last edited by a moderator: Mar 26, 2020
  2. Online

    timtower Moderator Moderator

    @SizGen Does the message show? Tried printing the label?
    What does happen?
  3. Offline


    As i see now, you haven't registered your Executor in Main class. What's the problem? Try adding item and then apllying meta, maybe something would change
Thread Status:
Not open for further replies.

Share This Page