4242
4343import java .util .List ;
4444
45+ /**
46+ * A utility class to generate GUIs for the goPaint plugin.
47+ * @version 1.0.0
48+ * @since 1.0.0
49+ */
4550public final class GUI {
4651
4752 private static final String INCREASE_DECREASE_LORE = "\n §7Left click to increase\n §7Right click to decrease" ;
@@ -57,12 +62,21 @@ private GUI() {
5762 throw new UnsupportedOperationException ("This class cannot be instantiated" );
5863 }
5964
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 ) {
6171 Inventory inv = Bukkit .createInventory (null , 54 , Component .text ("goPaint Menu" , NamedTextColor .DARK_BLUE ));
6272 update (inv , pb );
6373 return inv ;
6474 }
6575
76+ /**
77+ * Generates an {@link Inventory} with all the brushes represented by an {@link ItemStack}.
78+ * @return the generated inventory
79+ */
6680 public static @ NotNull Inventory generateBrushes () {
6781 Inventory inv = Bukkit .createInventory (null , 27 , Component .text ("goPaint Brushes" , NamedTextColor .DARK_BLUE ));
6882 // FILLER
@@ -76,12 +90,21 @@ private GUI() {
7690 return inv ;
7791 }
7892
93+ /**
94+ * Applies a default formating to the given {@link Inventory}.
95+ * @param inventory the inventory to format
96+ */
7997 private static void formatDefault (@ NotNull Inventory inventory ) {
8098 for (int slot = 0 ; slot < inventory .getSize (); slot ++) {
8199 inventory .setItem (slot , LIME_DECORATION );
82100 }
83101 }
84102
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+ */
85108 public static void update (@ NotNull Inventory inventory , @ NotNull PlayerBrush playerBrush ) {
86109 Brush brush = playerBrush .brush ();
87110
@@ -155,6 +178,14 @@ public static void update(@NotNull Inventory inventory, @NotNull PlayerBrush pla
155178 inventory .setItem (21 , WHITE_DECORATION );
156179 }
157180
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+ }
158189 // angle settings
159190 if (brush instanceof GradientBrush ) {
160191 inventory .setItem (4 , WHITE_DECORATION );
@@ -165,15 +196,6 @@ public static void update(@NotNull Inventory inventory, @NotNull PlayerBrush pla
165196 inventory .setItem (22 , WHITE_DECORATION );
166197 }
167198
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-
177199
178200 // Size
179201 inventory .setItem (5 , WHITE_DECORATION );
@@ -289,5 +311,4 @@ private static void addSurfaceModeSwitch(@NotNull Inventory inv, @NotNull Player
289311 ));
290312 inv .setItem (25 , pane );
291313 }
292-
293314}
0 commit comments