Hello everyone! I am finally writing this up, even though my library has been out for a while, I have been debugging it intensively, and it seems to be at a perfectly working state.
What is MenuEngine?
MenuEngine is a library, that makes it extremely easy to create custom menu's, including very simple ones, to complex and dynamic ones.
Why MenuEngine?
I have used many menu libraries before, but there always have been certain problems with them, where I wouldn't be able to use them for very complex inventories, or they would lag intensively, or even worse: break and not work at all. I have created MenuEngine, in the hope of fixing all of the above.
Usage:
For Server Owners
Download latest version from Here and put it in your plugins folder.
For Developers:
Yes, it doesn't require a repository, it is in the central Maven repository.
Code (Text):
<dependency>
<groupId>me.vilsol</groupId>
<artifactId>menuengine</artifactId>
<version>1.4.7</version>
</dependency>
<groupId>me.vilsol</groupId>
<artifactId>menuengine</artifactId>
<version>1.4.7</version>
</dependency>
Spoiler: Example
This example will create a menu, with an item that looks like an arrow, and once it left/right clicked, it will send a message to the player who clicked it and with which button.
TestPlugin.class
It is required that every object is initialized at least once.
It is required that every object is initialized at least once.
Code (Text):
public class TestPlugin extends JavaPlugin {
public void onEnable(){
// Register Items
new ExampleItem().registerItem();
// Register Menus
new MainMenu();
}
}
public void onEnable(){
// Register Items
new ExampleItem().registerItem();
// Register Menus
new MainMenu();
}
}
MainMenu.class
In the simple MenuModel, you can simply add items in the constructor, by only passing the class of the item, and the slot you want the place the item in.
In the simple MenuModel, you can simply add items in the constructor, by only passing the class of the item, and the slot you want the place the item in.
Code (Text):
public class MainMenu extends MenuModel {
public MainMenu() {
super(9, "Main Menu");
getMenu().addItem(ExampleItem.class, 0);
}
}
public MainMenu() {
super(9, "Main Menu");
getMenu().addItem(ExampleItem.class, 0);
}
}
ExampleItem.class
Every menu item has to have its own class. Each item must have a registerItem() method, which will register the item in the MenuEngine.
Every menu item has to have its own class. Each item must have a registerItem() method, which will register the item in the MenuEngine.
Code (Text):
public class ExampleItem implements MenuItem {
@Override
public void registerItem() {
MenuItem.items.put(this.getClass(), this);
}
@Override
public void execute(Player plr, ClickType click) {
plr.closeInventory();
if(click == ClickType.LEFT){
plr.sendMessage("You Left Clicked!");
}else if(click == ClickType.RIGHT){
plr.sendMessage("You Right Clicked!");
}
}
@Override
public ItemStack getItem() {
return new Builder(Material.ARROW).name("Example Item").item();
}
}
@Override
public void registerItem() {
MenuItem.items.put(this.getClass(), this);
}
@Override
public void execute(Player plr, ClickType click) {
plr.closeInventory();
if(click == ClickType.LEFT){
plr.sendMessage("You Left Clicked!");
}else if(click == ClickType.RIGHT){
plr.sendMessage("You Right Clicked!");
}
}
@Override
public ItemStack getItem() {
return new Builder(Material.ARROW).name("Example Item").item();
}
}
Quick facts
- Edition: Minecraft Java
- File type: .jar
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
MenuEngine is a free Minecraft Java mod. Downloaded 475 times (via Spigot). Download it and open it directly in the game.