11package com .sentropic .guiapi .gui ;
22
33import com .sentropic .guiapi .GUIAPI ;
4+ import com .sentropic .guiapi .GUIManager ;
45import net .md_5 .bungee .api .ChatMessageType ;
56import net .md_5 .bungee .api .chat .BaseComponent ;
67import net .md_5 .bungee .api .chat .TextComponent ;
@@ -63,13 +64,22 @@ public class GUI {
6364 private final Player player ;
6465 private final List <GUIComponent > guiComponents = new ArrayList <>();
6566
66- GUI (Player player ) {
67+
68+ /**
69+ * Important: If you need to get a player's GUI, use {@link GUIManager#getGUI(Player)},
70+ * since GUIs created through this constructor will not be processed.
71+ *
72+ * @param player the player the GUI belongs to.
73+ */
74+ @ Deprecated
75+ public GUI (Player player ) {
6776 this .player = player ;
6877 guiComponents .add (defaultComponent );
6978 }
7079
7180 /**
7281 * Gets the owner of this GUI
82+ *
7383 * @return the {@link Player} to whom this GUI belongs to
7484 */
7585 @ SuppressWarnings ("unused" )
@@ -80,6 +90,7 @@ public class GUI {
8090 /**
8191 * Adds the given {@link GUIComponent} to the GUI after all previously added GUIComponents,
8292 * and removes any other component with the same ID as the given one
93+ *
8394 * @param component the GUIComponent to add to the GUI
8495 */
8596 public void putOnTop (@ NotNull GUIComponent component ) {
@@ -92,6 +103,7 @@ public void putOnTop(@NotNull GUIComponent component) {
92103 /**
93104 * Adds the given {@link GUIComponent} to the GUI before all previously added GUIComponents,
94105 * and removes any other component with the same ID as the given one
106+ *
95107 * @param component the GUIComponent to add to the GUI
96108 */
97109 @ SuppressWarnings ("unused" )
@@ -105,6 +117,7 @@ public void putUnderneath(@NotNull GUIComponent component) {
105117 /**
106118 * If a {@link GUIComponent} exists with an ID matching the one of the given component,
107119 * removes it and puts the given one in its place
120+ *
108121 * @param component the GUIComponent to add to the GUI
109122 * @return whether the component could be added
110123 */
@@ -130,6 +143,7 @@ public boolean update(@NotNull GUIComponent component) {
130143 /**
131144 * If a {@link GUIComponent} exists with an ID matching the given id,
132145 * adds the provided component after it, and removes any other component with the same ID as it
146+ *
133147 * @param component the GUIComponent to add to the GUI
134148 * @return whether the component could be added
135149 */
@@ -154,6 +168,7 @@ public boolean putAfter(String id, @NotNull GUIComponent component) {
154168 /**
155169 * If a {@link GUIComponent} exists with an ID matching the given id,
156170 * adds the provided component} before it, and removes any other component with the same ID as it
171+ *
157172 * @param component the GUIComponent to add to the GUI
158173 * @return whether the component could be added
159174 */
@@ -177,6 +192,7 @@ public boolean putBefore(String before, @NotNull GUIComponent component) {
177192
178193 /**
179194 * If a {@link GUIComponent} exists with an ID matching the given id, removes it from the GUI
195+ *
180196 * @return whether a component with a matching id was removed
181197 */
182198 @ SuppressWarnings ("UnusedReturnValue" )
@@ -187,6 +203,7 @@ public boolean remove(String id) {
187203
188204 /**
189205 * Removes any {@link GUIComponent}s that meet a given predicate from the GUI
206+ *
190207 * @param predicate the predicate that to-be-removed {@link GUIComponent}s must meet
191208 * @return whether any {@link GUIComponent}s were removed
192209 */
@@ -218,12 +235,14 @@ private static void checkID(String id) {
218235
219236 /**
220237 * Gets whether this GUI is in debug mode (displaying the debug {@link GUIComponent}s defined in the plugin's config)
238+ *
221239 * @return whether this GUI is in debug mode
222240 */
223241 public boolean isDebugging () { return debug ; }
224242
225243 /**
226244 * Sets this GUI to debug mode if debug is true, or disables it otherwise
245+ *
227246 * @param debug whether to put the GUI in debug mode or not
228247 */
229248 public void setDebug (boolean debug ) {
@@ -308,6 +327,7 @@ public void onReload() {
308327 * Adds an {@link AnonComponent} containing the given baseComponent
309328 * Because the content of other {@link BaseComponent} implementations are unknown to the server,
310329 * only supports {@link TextComponent} at this moment
330+ *
311331 * @param baseComponent the anonymous chat component to add to the GUI
312332 * @return whether the given baseComponent was of the supported types and could be added
313333 */
@@ -334,6 +354,7 @@ public boolean addAnonComponent(BaseComponent baseComponent) {
334354
335355 /**
336356 * Removes the given anonymous component from the GUI
357+ *
337358 * @param component the anonymous component to remove
338359 */
339360 public void removeAnonComponent (AnonComponent component ) {
@@ -394,13 +415,15 @@ private void reschedule() {
394415
395416 /**
396417 * Used to distinguish between action bar text sent by {@link GUIAPI} and those send anonymously
418+ *
397419 * @return whether {@link GUIAPI} is sending an action bar packet at the moment of calling
398420 */
399421 public static boolean isSending () { return sending ; }
400422
401423 /**
402424 * Builds a {@link String} containing the specified amount of space,
403425 * from space characters provided by AmberW's Negative Space resource pack
426+ *
404427 * @param amount the amount of space to generate the string for, whether positive, negative or zero
405428 * @return the built {@link String} containing the specified amount of space
406429 */
0 commit comments