Jake F.
Jake F.

Reputation: 141

Java Bukkit - plugin cannot be resolved to a variable

I really need help with this. I tried a lot of suggestions online from a google search but I didn't get much. Some solutions I tried to come up with myself were:

public LunarCore plugin = new LunarCore();

but I don't know for sure if that will work. Here is my code

IconMenu menu = new IconMenu("Idle Menu", 9, new IconMenu.OptionClickEventHandler() {
    @Override
    public void onOptionClick(IconMenu.OptionClickEvent event) {
        event.getPlayer().sendMessage("You have chosen " + event.getName());
        event.setWillClose(true);
    }
}, plugin)
.setOption(3, new ItemStack(Material.GOLD_INGOT, 1), "Shop")

And obviously it is on

        }
}, plugin)

"plugin"

Upvotes: 0

Views: 183

Answers (1)

Cath
Cath

Reputation: 462

In case this is a class seperated from your main-class, try

private Plugin plugin;

public InventoryClassName(Plugin plugin){

this.plugin = plugin;

}

and then pass on "this" as parameter when accessing the class through your main-class

Upvotes: 1

Related Questions