How can i fix this errror?

Discussion in 'Spigot Plugin Development' started by teeter11, Jul 12, 2015.

  1. So i got a red underline on this line of code :

    s.getItemInHand().spigot().setUnbreakable(true);

    and it says :

    The method spigot() is undefined for the type ItemStack

    I have the following in references libraries :

    spigot-api-1.8.7-R0.1-SNAPSHOT.jar

    heres my code :


    package me.Teeter11.BearUnbreakingTools;

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.*;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.java.JavaPlugin;

    public class BearUnbreakingTools extends JavaPlugin {

    public void onEnable(){

    }

    @Override
    public boolean onCommand(CommandSender sender, Command cmd,String label, String[] args){
    if (cmd.getName().equalsIgnoreCase("unbreakable")){
    if (!(sender instanceof Player)) {

    return true;
    }
    Player s = (Player) sender;

    s.getItemInHand().spigot().setUnbreakable(true);

    }
    return false;
    }


    }