Library [1.8/1.7] MenuEngine - Create simple and complex menus easily

Discussion in 'Resources' started by Vilsol, Feb 24, 2015.

Thread Status:
Not open for further replies.
  1. Offline


    GitHub Repo
    Current version: 1.3​

    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.


    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.
    1. <dependency>
    2. <groupId>me.vilsol</groupId>
    3. <artifactId>menuengine</artifactId>
    4. <version>1.3</version>
    5. </dependency>

    Example (open)

    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.

    It is required that every object is initialized at least once.​
    1. public class TestPlugin extends JavaPlugin {
    2. public void onEnable(){
    3. // Register Items
    4. new ExampleItem().registerItem();
    5. // Register Menus
    6. new MainMenu();
    7. }
    8. }

    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.​
    1. public class MainMenu extends MenuModel {
    2. public MainMenu() {
    3. super(9, "Main Menu");
    4. getMenu().addItem(ExampleItem.class, 0);
    5. }
    6. }

    Every menu item has to have its own class. Each item must have a registerItem() method, which will register the item in the MenuEngine.​
    1. public class ExampleItem implements MenuItem {
    2. @Override
    3. public void registerItem() {
    4. MenuItem.items.put(this.getClass(), this);
    5. }
    7. @Override
    8. public void execute(Player plr, ClickType click) {
    9. plr.closeInventory();
    10. if(click == ClickType.LEFT){
    11. plr.sendMessage("You Left Clicked!");
    12. }else if(click == ClickType.RIGHT){
    13. plr.sendMessage("You Right Clicked!");
    14. }
    15. }
    17. @Override
    18. public ItemStack getItem() {
    19. return new Builder(Material.ARROW).setName("Example Item").getItem();
    20. }
    21. }

    Last edited: Feb 26, 2015
    GrandmaJam and Skionz like this.
  2. Offline


        public ItemStack getItem() {
            return new Builder(Material.ARROW).setName("Example Item").getItem();
    Those are incorrect builder pattern naming conventions.
  3. Offline


    @_Filip Will be fixed in the next release
  4. Offline


    @Vilsol You're a pretty goofy guy.
    Regablith likes this.
  5. Offline


    Any criticism is welcome!
  6. Offline


    Released version 1.3.5

    Only one change in this release (though I learned how to auto-deploy to maven central), but this release deprecates old builder methods, and added new ones!
  7. Offline


    Hi there, I'm trying to use this API but I can't get it to work in an easy way.

    The only thing I could get to use it and show the menu was this:
                    Menu m = MenuModel.getMenu(AdminMenu.class).getMenu();
                    m.addItem(ExampleItem.class, 0);
                    m.addItem(AdminCreateArena.class, 12);
    As if I do the .getMenu().showToPlayer(p) without adding the items first (there are the getItem.add... in the AdminMenu class) it shows the menu without items.
Thread Status:
Not open for further replies.

Share This Page