-
Notifications
You must be signed in to change notification settings - Fork 2
Getting started
Itz_KiwiSap_ edited this page Apr 24, 2024
·
18 revisions
In order to get started you would need to add the libary to your project using maven or gradle
Maven dependency:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.odalita-developments.odalitamenus</groupId>
<artifactId>core</artifactId>
<version>v0.5.2</version>
</dependency>
Gradle dependency:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.odalita-developments.odalitamenus:core:v0.5.2'
}
public final class TestPlugin extends JavaPlugin {
private OdalitaMenus odalitaMenus;
@Override
public void onEnable() {
odalitaMenus = OdalitaMenus.createInstance(this);
}
}
In order to define the name and rows your would like your menu to have you'll need to add our annotation above your class as follow
@Menu(
title = "Test Menu"
)
public final class TestMenu {
}
Once you have completed the step above you will need to inherit the MenuProvider to complete the creation of your menu.
@Menu(
title = "Test Menu"
)
public final class TestMenu implements PlayerMenuProvider {
@Override
public void onLoad(@NotNull Player player, @NotNull MenuContents menuContents) {
// This is where you would add your items to the menu
}
}
Now the menu is created we want to open this menu for a player.
public final class TestPlugin extends JavaPlugin {
private OdalitaMenus odalitaMenus;
@Override
public void onEnable() {
odalitaMenus = OdalitaMenus.createInstance(this);
}
public void openTestMenu(Player player) {
this.odalitaMenus.openMenu(new TestMenu(), player);
}
}
Now we know how to create a simple menu instance and how to open it for a player. The next thing on the Wiki is the menu types, learn more about this here.