|
@@ -34,6 +34,7 @@ public abstract class InventoryGUI implements InventoryHolder {
|
|
|
this.title = title;
|
|
this.title = title;
|
|
|
this.size = size;
|
|
this.size = size;
|
|
|
this.inventory = Bukkit.createInventory(this, size, title);
|
|
this.inventory = Bukkit.createInventory(this, size, title);
|
|
|
|
|
+ buildContent();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void handleClick(Player player, int slot, ClickType type) {
|
|
public void handleClick(Player player, int slot, ClickType type) {
|
|
@@ -109,12 +110,22 @@ public abstract class InventoryGUI implements InventoryHolder {
|
|
|
* Opens the previous GUI if available.
|
|
* Opens the previous GUI if available.
|
|
|
*/
|
|
*/
|
|
|
public void openPrevious(Player player) {
|
|
public void openPrevious(Player player) {
|
|
|
- if (!previousGuis.isEmpty()) {
|
|
|
|
|
|
|
+ if (hasPreviousGUI()) {
|
|
|
InventoryGUI previousGui = previousGuis.pop();
|
|
InventoryGUI previousGui = previousGuis.pop();
|
|
|
previousGui.update();
|
|
previousGui.update();
|
|
|
InventoryManager.openFor(player, previousGui);
|
|
InventoryManager.openFor(player, previousGui);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ public void setNextPageButton(int slot, InventoryGUI gui){
|
|
|
|
|
+ ItemStack item = new ItemStack(Material.ARROW);
|
|
|
|
|
+ ItemMeta meta = item.getItemMeta();
|
|
|
|
|
+ meta.displayName(Component.text("Next Page", NamedTextColor.GREEN));
|
|
|
|
|
+ item.setItemMeta(UnItalic.removeItalicFromMeta(meta));
|
|
|
|
|
+ setItemWithClickAction(slot, item, (p, type) -> {
|
|
|
|
|
+ openNext(p, gui);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public void setBackButton(int slot){
|
|
public void setBackButton(int slot){
|
|
|
ItemStack item = new ItemStack(Material.ARROW);
|
|
ItemStack item = new ItemStack(Material.ARROW);
|
|
|
ItemMeta meta = item.getItemMeta();
|
|
ItemMeta meta = item.getItemMeta();
|
|
@@ -144,6 +155,7 @@ public abstract class InventoryGUI implements InventoryHolder {
|
|
|
return inventory;
|
|
return inventory;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public abstract void buildContent();
|
|
|
public abstract void update();
|
|
public abstract void update();
|
|
|
|
|
|
|
|
public interface AutoCloseHandler {
|
|
public interface AutoCloseHandler {
|