Skip to content

Commit 4520d76

Browse files
committed
Inventory GUI fixes after recent changes broke them
1 parent 7e95c40 commit 4520d76

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/main/java/vg/civcraft/mc/civmodcore/inventorygui/ClickableInventory.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,10 @@ public class ClickableInventory {
4545
* name of the inventory which is shown at the top when a player has it open
4646
*/
4747
public ClickableInventory(InventoryType type, String name) {
48-
if (name == null) {
49-
throw new IllegalArgumentException("Inventory name may not be null");
50-
}
48+
this(name);
5149
if (type == null) {
5250
throw new IllegalArgumentException("Inventory type may not be null");
5351
}
54-
if (name.length() > 32) {
55-
log.warning("ClickableInventory title exceeds Bukkit limits: " + name);
56-
name = name.substring(0, 32);
57-
}
58-
this.runnables = new LinkedList<>();
5952
inventory = Bukkit.createInventory(null, type, name);
6053
this.clickables = new IClickable[inventory.getSize() + 1];
6154
}
@@ -70,15 +63,20 @@ public ClickableInventory(InventoryType type, String name) {
7063
* name of the inventory which is shown at the top when a player has it open
7164
*/
7265
public ClickableInventory(int size, String name) {
66+
this(name);
67+
inventory = Bukkit.createInventory(null, size, name);
68+
this.clickables = new IClickable[size + 1];
69+
}
70+
71+
private ClickableInventory(String name) {
7372
if (name == null) {
7473
throw new IllegalArgumentException("Inventory name may not be null");
7574
}
7675
if (name.length() > 32) {
7776
log.warning("ClickableInventory title exceeds Bukkit limits: " + name);
7877
name = name.substring(0, 32);
7978
}
80-
inventory = Bukkit.createInventory(null, size, name);
81-
this.clickables = new IClickable[size + 1];
79+
this.runnables = new LinkedList<>();
8280
}
8381

8482
/**

0 commit comments

Comments
 (0)