# Create furnace menu

## Methods

<details>

<summary>onOpenMenu [OVERRIDE]</summary>

This event is called when player open the menu

```java
protected abstract void onOpenMenu(Player player);
```

</details>

<details>

<summary>onCloseMenu [OVERRIDE]</summary>

This event is called when player close the menu

```java
protected abstract void onCloseMenu(Player player);
```

</details>

<details>

<summary>refreshPage</summary>

I'm inviting you to see the same doc on refreshPage in [this part](/kap-easy-menu-plugin/dev-manual/create-a-menu/create-simple-menu.md).

</details>

{% tabs %}
{% tab title="Version 2." %}

## Create your first menu

```java
public class MySimpleMenu extends FurnaceMenu {
    public MySimpleMenu(JavaPlugin plugin) {
        super(plugin, "My Menu Title");
    }
    
    @Override
    protected void onCloseMenu(Player player) {
        //event when user open your menu
    }
    
    @Override
    protected void onOpenMenu(Player player) {
        //event when user close your menu
    }
}
```

Now you have your menu, let's add it to menu system.

```java
public MyPlugin extends JavaPlugin {
    GuiManager guiManager;
    
    public MyPlugin() {
    
    }
    
    private void initMyMenus() {
        MySimpleMenu simpleMenu = new MySimpleMenu(this);
        guiManager.registerMenus(simpleMenu, "MySimpleMenu");
    }
}
```

{% hint style="warning" %}
To init GuiManager, please refer to this documentation :&#x20;

[Init your plugin](/kap-easy-menu-plugin/dev-manual/init-your-plugin.md)
{% endhint %}

## Add items in menu

Type of item place in furnace :&#x20;

* SMELTING
* FUEL
* RESULT

```java
public class MySimpleMenu extends ChestMenu {
    public MySimpleMenu(JavaPlugin plugin) {
        ...
        GuiItem item = new GuiItem(...);
        // add item in smelting pace
        addItem(item, FurnacePlace.SMELTING);
    }
    
    @Override
    protected void onOpenMenu(Player player) {
        GuiItem otherItem = new GuiItem(...);
        // place only for the player otherItem in fuel
        addItem(player, otherItem, FurnacePlace.FUEL);
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kap35.gitbook.io/kap-easy-menu-plugin/dev-manual/create-a-menu/create-furnace-menu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
