@@ -45,17 +45,10 @@ public class ClickableInventory {
45
45
* name of the inventory which is shown at the top when a player has it open
46
46
*/
47
47
public ClickableInventory (InventoryType type , String name ) {
48
- if (name == null ) {
49
- throw new IllegalArgumentException ("Inventory name may not be null" );
50
- }
48
+ this (name );
51
49
if (type == null ) {
52
50
throw new IllegalArgumentException ("Inventory type may not be null" );
53
51
}
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 <>();
59
52
inventory = Bukkit .createInventory (null , type , name );
60
53
this .clickables = new IClickable [inventory .getSize () + 1 ];
61
54
}
@@ -70,15 +63,20 @@ public ClickableInventory(InventoryType type, String name) {
70
63
* name of the inventory which is shown at the top when a player has it open
71
64
*/
72
65
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 ) {
73
72
if (name == null ) {
74
73
throw new IllegalArgumentException ("Inventory name may not be null" );
75
74
}
76
75
if (name .length () > 32 ) {
77
76
log .warning ("ClickableInventory title exceeds Bukkit limits: " + name );
78
77
name = name .substring (0 , 32 );
79
78
}
80
- inventory = Bukkit .createInventory (null , size , name );
81
- this .clickables = new IClickable [size + 1 ];
79
+ this .runnables = new LinkedList <>();
82
80
}
83
81
84
82
/**
0 commit comments