42
42
43
43
import java .util .List ;
44
44
45
+ /**
46
+ * A utility class to generate GUIs for the goPaint plugin.
47
+ * @version 1.0.0
48
+ * @since 1.0.0
49
+ */
45
50
public final class GUI {
46
51
47
52
private static final String INCREASE_DECREASE_LORE = "\n §7Left click to increase\n §7Right click to decrease" ;
@@ -57,12 +62,21 @@ private GUI() {
57
62
throw new UnsupportedOperationException ("This class cannot be instantiated" );
58
63
}
59
64
60
- public static @ NotNull Inventory create (PlayerBrush pb ) {
65
+ /**
66
+ * Creates a new {@link Inventory} with the current {@link PlayerBrush} settings.
67
+ * @param pb the player brush to get the settings from
68
+ * @return the generated inventory
69
+ */
70
+ public static @ NotNull Inventory create (@ NotNull PlayerBrush pb ) {
61
71
Inventory inv = Bukkit .createInventory (null , 54 , Component .text ("goPaint Menu" , NamedTextColor .DARK_BLUE ));
62
72
update (inv , pb );
63
73
return inv ;
64
74
}
65
75
76
+ /**
77
+ * Generates an {@link Inventory} with all the brushes represented by an {@link ItemStack}.
78
+ * @return the generated inventory
79
+ */
66
80
public static @ NotNull Inventory generateBrushes () {
67
81
Inventory inv = Bukkit .createInventory (null , 27 , Component .text ("goPaint Brushes" , NamedTextColor .DARK_BLUE ));
68
82
// FILLER
@@ -76,12 +90,21 @@ private GUI() {
76
90
return inv ;
77
91
}
78
92
93
+ /**
94
+ * Applies a default formating to the given {@link Inventory}.
95
+ * @param inventory the inventory to format
96
+ */
79
97
private static void formatDefault (@ NotNull Inventory inventory ) {
80
98
for (int slot = 0 ; slot < inventory .getSize (); slot ++) {
81
99
inventory .setItem (slot , LIME_DECORATION );
82
100
}
83
101
}
84
102
103
+ /**
104
+ * Updates the given {@link Inventory} with the current {@link PlayerBrush} settings.
105
+ * @param inventory the inventory to update
106
+ * @param playerBrush the player brush to get the settings from
107
+ */
85
108
public static void update (@ NotNull Inventory inventory , @ NotNull PlayerBrush playerBrush ) {
86
109
Brush brush = playerBrush .brush ();
87
110
@@ -155,6 +178,14 @@ public static void update(@NotNull Inventory inventory, @NotNull PlayerBrush pla
155
178
inventory .setItem (21 , WHITE_DECORATION );
156
179
}
157
180
181
+ if (brush instanceof SplatterBrush || brush instanceof PaintBrush || brush instanceof GradientBrush ) {
182
+ inventory .setItem (3 , WHITE_DECORATION );
183
+ inventory .setItem (12 , Items .create (Material .BLAZE_POWDER , 1 ,
184
+ "§6Falloff Strength: §e" + playerBrush .falloffStrength () + "%" ,
185
+ INCREASE_DECREASE_LORE
186
+ ));
187
+ inventory .setItem (21 , WHITE_DECORATION );
188
+ }
158
189
// angle settings
159
190
if (brush instanceof GradientBrush ) {
160
191
inventory .setItem (4 , WHITE_DECORATION );
@@ -165,15 +196,6 @@ public static void update(@NotNull Inventory inventory, @NotNull PlayerBrush pla
165
196
inventory .setItem (22 , WHITE_DECORATION );
166
197
}
167
198
168
- if (brush instanceof SplatterBrush || brush instanceof PaintBrush || brush instanceof GradientBrush ) {
169
- inventory .setItem (3 , WHITE_DECORATION );
170
- inventory .setItem (12 , Items .create (Material .BLAZE_POWDER , 1 ,
171
- "§6Falloff Strength: §e" + playerBrush .falloffStrength () + "%" ,
172
- INCREASE_DECREASE_LORE
173
- ));
174
- inventory .setItem (21 , WHITE_DECORATION );
175
- }
176
-
177
199
178
200
// Size
179
201
inventory .setItem (5 , WHITE_DECORATION );
@@ -289,5 +311,4 @@ private static void addSurfaceModeSwitch(@NotNull Inventory inv, @NotNull Player
289
311
));
290
312
inv .setItem (25 , pane );
291
313
}
292
-
293
314
}
0 commit comments