> For the complete documentation index, see [llms.txt](https://icrossing.gitbook.io/carouselselector/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://icrossing.gitbook.io/carouselselector/api/open-a-3d-menu.md).

# Open a 3D-Menu

Here's an example of how to open a 3D menu for a player

```java
public class Main extends JavaPlugin implements Listener {

    private CarouselSelectorPlugin instance;
    
    @Override
    public void onEnable() {
        instance = CarouselSelectorPlugin.getInstance();
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        Action action = event.getAction();
        ItemStack item = event.getItem();
        
        if (item != null && item.getType() == Material.DIAMOND && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK)) {
            Menu menu = new Menu(player, "Menu title");

            this.instance.getApi().open(menu);
        }
    }
}
```
