Skip to content

Commit

Permalink
Inventory GUI fixes after recent changes broke them
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxopoly committed Sep 30, 2019
1 parent 7e95c40 commit 4520d76
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,10 @@ public class ClickableInventory {
* name of the inventory which is shown at the top when a player has it open
*/
public ClickableInventory(InventoryType type, String name) {
if (name == null) {
throw new IllegalArgumentException("Inventory name may not be null");
}
this(name);
if (type == null) {
throw new IllegalArgumentException("Inventory type may not be null");
}
if (name.length() > 32) {
log.warning("ClickableInventory title exceeds Bukkit limits: " + name);
name = name.substring(0, 32);
}
this.runnables = new LinkedList<>();
inventory = Bukkit.createInventory(null, type, name);
this.clickables = new IClickable[inventory.getSize() + 1];
}
Expand All @@ -70,15 +63,20 @@ public ClickableInventory(InventoryType type, String name) {
* name of the inventory which is shown at the top when a player has it open
*/
public ClickableInventory(int size, String name) {
this(name);
inventory = Bukkit.createInventory(null, size, name);
this.clickables = new IClickable[size + 1];
}

private ClickableInventory(String name) {
if (name == null) {
throw new IllegalArgumentException("Inventory name may not be null");
}
if (name.length() > 32) {
log.warning("ClickableInventory title exceeds Bukkit limits: " + name);
name = name.substring(0, 32);
}
inventory = Bukkit.createInventory(null, size, name);
this.clickables = new IClickable[size + 1];
this.runnables = new LinkedList<>();
}

/**
Expand Down

0 comments on commit 4520d76

Please sign in to comment.