-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the documentation for The New Menu Library! This library provides a powerful and flexible framework for creating graphical user interfaces (GUIs) in Minecraft plugins. Whether you want to create custom menus for Folia, Spigot, Paper or Sponge, this library is for you!
The New Menu Library is designed to simplify the process of creating interactive menus and UIs in Minecraft plugins. It provides a clean and intuitive API for constructing menus, defining icons, and handling player interactions. Whether you're a seasoned developer or new to plugin development, this library aims to enhance the user experience by making menu creation easy and enjoyable.
To start using The New Menu Library in your project, follow these installation steps:
-
Add The New Menu Library to your project's dependencies.
<!-- Replace with the actual version --> <dependency> <groupId>net.tnemc</groupId> <artifactId>menu</artifactId> <version>VERSION</version> <scope>provided</scope> </dependency>
-
Make sure to include the library in your plugin's dependencies.
Here's a simple example using MenuBuilder
to create a basic menu:
import net.tnemc.menu.core.Menu;
import net.tnemc.menu.core.Page;
import net.tnemc.menu.core.icon.Icon;
import net.tnemc.menu.core.builders.MenuBuilder;
import net.tnemc.menu.core.utils.SlotPos;
public class MyPluginMenu {
public void createMenu() {
// Creating a simple menu with MenuBuilder
Menu menu = new MenuBuilder()
.withName("exampleMenu")
.withTitle("Example Menu")
.withRows(3)
.withPage(
new Page(1)
.withIcon(
new IconBuilder()
.withItemStack("Item 1", "DIAMOND", 1)
.withSlot(new SlotPos(1, 1))
.build()
)
.withIcon(
new IconBuilder()
.withItemStack("Item 2", "GOLD_INGOT", 1)
.withSlot(new SlotPos(2, 2))
.build()
)
.build()
)
.build();
// Register the menu with MenuManager
MenuManager.instance().addMenu(menu);
}
}
This example demonstrates creating a simple menu with two pages, each containing icons with different items.
- Easy menu and icon creation with a builder pattern.
- Support for various player interactions, such as clicks and chat input.
- Flexible constraint system for defining conditions and behaviors.
- Stateful icons for dynamic menu elements.
- Integration with the MenuManager for easy menu registration and handling.
The Menu
class represents a menu in the library. It provides methods for adding pages, handling player interactions, and more.
The Icon
class represents an icon in a menu. Icons can have actions, constraints, and dynamic item providers.
The MenuBuilder
class is a builder for creating instances of the Menu
class. It provides methods for setting menu properties and adding pages.
The IconBuilder
class is a builder for creating instances of the Icon
class. It provides methods for setting icon properties, adding actions, and applying constraints.
For detailed documentation and usage examples, refer to the specific class documentation.
We welcome contributions from the community! Whether it's bug fixes, feature enhancements, or documentation improvements, feel free to submit pull requests.
- Fork the repository.
- Create a branch for your changes.
- Make your changes and commit them with clear messages.
- Push your branch to your fork.
- Submit a pull request.
This library is licensed under the GNU Affero General Public License (AGPL-3.0). See the LICENSE file for details.