-
Notifications
You must be signed in to change notification settings - Fork 2
Getting Started
FlameyosFlow edited this page Sep 26, 2023
·
1 revision
when enabling your Plugin (extending JavaPlugin) you should add these lines at the start:
@Override
public void onEnable() {
Menus.init(this);
...
}
This is needed for the library to work.
It initializes the plugin everywhere, and allows NBT to work. you know, that thing that is used in every MenuItem object?
To create MenuItem you should be using:
MenuItem item = ItemBuilder.of(Material.STONE).buildItem();
so that you get all the flexibility; just to show how flexible ItemBuilder can get:
MenuItem item = ItemBuilder.of(Material.DIAMOND_SWORD, 3) // 3 diamond swords
.setName("&aAwesome") // colorized by default
.setLore(
colorize("&cThis is an Awesome Item"),
colorize("&cLike and SUBSCRIBE!"),
false) // false means don't colorize, might be faster
.addEnchant(Enchantment.DAMAGE_ALL)
.setUnbreakable(true)
.addEnchant(...)
.setDamage(100) // damage them. make it have ItemStack#getDurability - 100.
.buildItem(event -> {
event.getPlayer().sendMessage("You clicked this in a BaseMenu+");
return ActionResponse.DONE; // nothing happens in this.
});