[F
[For Devs] GUI API. Easily create GUIs (MMenu)
v1.0This API helps developers to create graphical user interfaces.
MMenu
With this API developers can easily create Graphical User Interfaces (GUIs). This resource is open source: mplugins.org/code/MMenu
Get Started
- Register API with MMenu.register(this); in your onEnable-Method.
- Create a class for your GUI and let it extend from org.mplugins.mmenu.MMenu. You can set the GUI title and amount of rows inside the constructor.
- Inside setContents() you can place items into the GUI. The inventory is accessable via inventory.
- Inside handleClickAction() you can control what certain clicks should do.
- You can open the GUI with the following code:
TestMenu gui = new TestMenu(); gui.open(player);
Example Code
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.mplugins.mmenu.menu.Menu;
import java.util.Collections;
public class TestMenu extends Menu
{
public TestMenu()
{
super("Title", 3); // Set title and amount of rows
}
@Override
public void setContents()
{
ItemStack item = new ItemStack(Material.PAPER);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§9§lDemo Item");
meta.setLore(Collections.singletonList("§fClick for demo action! :)"));
item.setItemMeta(meta);
// Place items in the GUI
inventory.setItem(13, item);
}
@Override
public void handleClickAction(InventoryClickEvent inventoryClickEvent)
{
// This method gets called whenever a player clicks on an item inside the gui
ItemStack item = inventoryClickEvent.getCurrentItem();
Player player = (Player) inventoryClickEvent.getWhoClicked();
if (item.getType() == Material.PAPER)
player.sendMessage("§7[§cRESPONSE§7] §fGUI works!! Demo text.");
}
}
Speedcoding
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta
