Skip to content

Commit 9f1821b

Browse files
committed
prepare for an extensive MenuElement
1 parent e718018 commit 9f1821b

3 files changed

Lines changed: 45 additions & 15 deletions

File tree

src/main/java/me/hsgamer/bettergui/api/button/MenuButton.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public Map<String, Object> getOptions() {
5858
return options;
5959
}
6060

61+
@Override
6162
public String getName() {
6263
return name;
6364
}

src/main/java/me/hsgamer/bettergui/api/menu/Menu.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* The menu
1313
*/
14-
public abstract class Menu {
14+
public abstract class Menu implements MenuElement {
1515
/**
1616
* The path of the menu settings
1717
*/
@@ -33,15 +33,6 @@ protected Menu(Config config) {
3333
variableManager.addExternalReplacer(BetterGUI.getInstance().get(VariableManager.class));
3434
}
3535

36-
/**
37-
* Get the name
38-
*
39-
* @return the name
40-
*/
41-
public String getName() {
42-
return config.getName();
43-
}
44-
4536
/**
4637
* Get the config
4738
*
@@ -51,15 +42,21 @@ public Config getConfig() {
5142
return config;
5243
}
5344

54-
/**
55-
* Get the variable manager
56-
*
57-
* @return the variable manager
58-
*/
45+
@Override
46+
public String getName() {
47+
return config.getName();
48+
}
49+
50+
@Override
5951
public VariableManager getVariableManager() {
6052
return variableManager;
6153
}
6254

55+
@Override
56+
public Menu getMenu() {
57+
return this;
58+
}
59+
6360
/**
6461
* Called when opening the menu for the player
6562
*

src/main/java/me/hsgamer/bettergui/api/menu/MenuElement.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,41 @@
11
package me.hsgamer.bettergui.api.menu;
22

3+
import me.hsgamer.hscore.variable.VariableManager;
4+
35
/**
46
* The element of the menu
57
*/
68
public interface MenuElement {
9+
/**
10+
* Get the parent element of this element
11+
*
12+
* @return the parent element
13+
*/
14+
// TODO: Implement
15+
default MenuElement getParent() {
16+
return null;
17+
}
18+
19+
/**
20+
* Get the name of the element
21+
*
22+
* @return the name
23+
*/
24+
// TODO: Implement
25+
default String getName() {
26+
return null;
27+
}
28+
29+
/**
30+
* Get the variable manager of the element
31+
*
32+
* @return the variable manager
33+
*/
34+
// TODO: Implement
35+
default VariableManager getVariableManager() {
36+
return null;
37+
}
38+
739
/**
840
* Get the menu containing the element
941
*

0 commit comments

Comments
 (0)