Chat Menus!

Discussion in 'Resources' started by Ad237, Feb 26, 2014.

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


    Hi guys. I created this small class that can easily create a menu in chat similar to bukkit's /help command and I decided to share it. You can set the amount of entries to display per page and the color and display name of the menu. You can add an unlimited amount of entries and display a page to the player easily.

    You can download the code here:

    An example using this is here:
    1. HelpMenu menu = new HelpMenu(ChatColor.DARK_AQUA + "Commands!", 9, ChatColor.GREEN);
    2. for(int x=0; x < 25; x++) {
    3. menu.addEntry("Entry: " + x);
    4. }
    5. menu.showPage(event.getPlayer(), 1);

    I would appreciate some credit if you do use this however it is not required.
    nelson2tm likes this.
  2. Offline


    Skyost likes this.
  3. Offline


  4. Offline


    Thanks :)
  5. Offline


    Nothing too fancy, just a quick way to add an organized text menu.


    Here's the code I used for testing. You'd obviously want to store the menu and save it for later use (to save having to make the menu for each time the command is called)
            if (args.length == 2 && args[0].equals("help") && MathUtils.isInt(args[1])) {
                try {
                    HelpMenu hm = new HelpMenu("Help Menu", 5, ChatColor.GREEN);
                    hm.addEntry("§aHere's the rules:");
                    hm.addEntry("§e1. §7Always follow rule #3.");
                    hm.addEntry("§e2. §7If in doubt, check rule #5");
                    hm.addEntry("§e3. §7When playing, obey rule #4");
                    hm.addEntry("§e4. §7Don't break rule #1!");
                    hm.addEntry("§e5. §7Please listen to rule #2.");
                    hm.showPage(player, Integer.valueOf(args[1]));
                } catch (Exception ex) {
                    player.sendMessage("§cUnable to show the help menu.");
    nelson2tm and Phasesaber like this.
  6. Offline


    Very well done. Looks great. :)
Thread Status:
Not open for further replies.

Share This Page