33import com .github .Fupery .InvMenu .API .Button .Button ;
44import com .github .Fupery .InvMenu .API .Event .MenuCloseReason ;
55import com .github .Fupery .InvMenu .API .Templates .MenuTemplate ;
6- import org . bukkit . Bukkit ;
6+ import com . github . Fupery . InvMenu . Utils . MenuType ;
77import org .bukkit .Material ;
88import org .bukkit .entity .Player ;
99import org .bukkit .event .inventory .ClickType ;
@@ -15,11 +15,19 @@ public abstract class CacheableMenu implements MenuTemplate {
1515
1616 protected MenuHandler handler ;
1717 protected String heading ;
18- protected InventoryType type ;
18+ protected MenuType type ;
1919 private Button [] buttons ;
2020 private boolean open = false ;
2121
2222 protected CacheableMenu (MenuHandler handler , String heading , InventoryType type ) {
23+ this (handler , heading , new MenuType (type ));
24+ }
25+
26+ protected CacheableMenu (MenuHandler handler , String heading , int size ) {
27+ this (handler , heading , new MenuType (size ));
28+ }
29+
30+ protected CacheableMenu (MenuHandler handler , String heading , MenuType type ) {
2331 this .handler = handler ;
2432 this .heading = (heading .length () > 32 ) ? this .heading = heading .substring (0 , 29 ) + "..." : heading ;
2533 this .type = type ;
@@ -34,7 +42,7 @@ private void loadButtons(Inventory inventory) {
3442 }
3543
3644 void open (Player player ) {
37- Inventory inventory = Bukkit .createInventory (player , type , heading );
45+ Inventory inventory = type .createInventory (player , heading );
3846 loadButtons (inventory );
3947 player .openInventory (inventory );
4048 onMenuOpenEvent (player );
0 commit comments