From 89fbacafac95a3e90a15d072137e2df922ddc263 Mon Sep 17 00:00:00 2001 From: Craftinators Date: Wed, 22 Jan 2025 10:48:29 -0500 Subject: [PATCH 01/10] docs(CosmeticTypeRegisterEvent): Improved Javadocs and added annotations --- .../api/events/CosmeticTypeRegisterEvent.java | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/CosmeticTypeRegisterEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/CosmeticTypeRegisterEvent.java index 4fd7f46c..7f223736 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/CosmeticTypeRegisterEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/CosmeticTypeRegisterEvent.java @@ -6,42 +6,50 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** - * Called when a cosmetic type not registered with HMCC default cosmetics is attempted to be registered. So if someone puts "test" in the config slot, and it's not a default cosmetic, this event will be called. + * Called when an attempt is made to register a cosmetic type that is not part of the default HMCC cosmetics. + *

+ * For example, if a user specifies "test" in the config slot, and it is not a default cosmetic, this event will be + * triggered. + *

*/ public class CosmeticTypeRegisterEvent extends Event { - private static final HandlerList handlers = new HandlerList(); + private static final HandlerList HANDLER_LIST = new HandlerList(); + private final String id; private final ConfigurationNode config; - public CosmeticTypeRegisterEvent(String id, ConfigurationNode config) { + public CosmeticTypeRegisterEvent(@NotNull String id, @NotNull ConfigurationNode config) { this.id = id; this.config = config; } /** - * Returns the id of the cosmetic trying to be registered. For example, "beanie" or "test" - * @return The id. This is the key in the cosmetic config + * Returns the id of the cosmetic attempting to be registered. + * + * @return the id of the cosmetic. This is the key in the cosmetic configuration. */ - public String getId() { + public @NotNull String getId() { return id; } /** - * This will already be in the nested node below the id in the config. - * @return The cosmetic config node in the cosmetic config that was attempted to get registered + * Retrieves the {@link ConfigurationNode} for the cosmetic that was attempted to be registered. + *

+ * This node is nested below the id in the configuration. + *

+ * + * @return the configuration node for the cosmetic in the cosmetic configuration */ - public ConfigurationNode getConfig() { + public @NotNull ConfigurationNode getConfig() { return config; } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } From 216c05ed9b14efb1fceb1502e9d7d5a79b9eeb31 Mon Sep 17 00:00:00 2001 From: Craftinators Date: Wed, 22 Jan 2025 10:50:31 -0500 Subject: [PATCH 02/10] docs(HMCCosmeticSetupEvent): Add missing period --- .../api/events/HMCCosmeticSetupEvent.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/HMCCosmeticSetupEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/HMCCosmeticSetupEvent.java index 3fb68dba..e79627ce 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/HMCCosmeticSetupEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/HMCCosmeticSetupEvent.java @@ -5,19 +5,17 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** - * Called when the plugin is set up and/or reloaded + * Called when the plugin is set up and/or reloaded. */ public class HMCCosmeticSetupEvent extends Event { - private static final HandlerList handlers = new HandlerList(); + private static final HandlerList HANDLER_LIST = new HandlerList(); @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } From 1f0f8e5f70ba6d1b7ccbfac04af141a218a9fb82 Mon Sep 17 00:00:00 2001 From: Craftinators Date: Wed, 22 Jan 2025 10:54:52 -0500 Subject: [PATCH 03/10] docs(PlayerCosmeticEvent): improve Javadocs --- .../api/events/PlayerCosmeticEvent.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEvent.java index e8dea6f4..b56b457b 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEvent.java @@ -5,23 +5,22 @@ import org.bukkit.event.Event; import org.jetbrains.annotations.NotNull; /** - * Represents a cosmetic user related event + * Represents an event related to a {@link CosmeticUser}. */ public abstract class PlayerCosmeticEvent extends PlayerEvent { - protected CosmeticUser user; + protected final CosmeticUser user; - public PlayerCosmeticEvent(@NotNull final CosmeticUser who) { + public PlayerCosmeticEvent(@NotNull CosmeticUser who) { super(who.getUniqueId()); user = who; } /** - * Returns the user involved in this event + * Returns the user involved in this event. * - * @return User who is involved in this event + * @return the user who is involved in this event */ - @NotNull - public final CosmeticUser getUser() { + public final @NotNull CosmeticUser getUser() { return user; } } From f6a14382999582e26fbf0fc9503bba743feb6403 Mon Sep 17 00:00:00 2001 From: Craftinators Date: Wed, 22 Jan 2025 10:55:04 -0500 Subject: [PATCH 04/10] docs(PlayerEvent): improve Javadocs --- .../hmccosmetics/api/events/PlayerEvent.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerEvent.java index 311486b0..44d96ef2 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerEvent.java @@ -5,20 +5,22 @@ import org.jetbrains.annotations.NotNull; import java.util.UUID; +/** + * Represents an event related to a {@link org.bukkit.entity.Player}. + */ public abstract class PlayerEvent extends Event { + protected final UUID player; - protected UUID player; - - public PlayerEvent(@NotNull final UUID uuid) { + public PlayerEvent(@NotNull UUID uuid) { this.player = uuid; } /** - * Returns the UUID of the player involved in this event - * @return User who is involved in this event + * Returns the {@link UUID} of the player involved in this event. + * + * @return the UUID of the player who is involved in this event */ - @NotNull - public final UUID getUniqueId() { + public final @NotNull UUID getUniqueId() { return player; } } From 330723a45cc77f81a19c52c141aecb9f17e357bb Mon Sep 17 00:00:00 2001 From: Craftinators Date: Wed, 22 Jan 2025 10:59:00 -0500 Subject: [PATCH 05/10] docs(PlayerCosmeticEquipEvent): improve Javadocs --- .../api/events/PlayerCosmeticEquipEvent.java | 37 ++++++++----------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEquipEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEquipEvent.java index 4c8db702..606ff020 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEquipEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEquipEvent.java @@ -6,23 +6,27 @@ import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; +import java.util.List; + /** - * Called when a player equips a cosmetic + * Called when a player equips a {@link Cosmetic}. */ public class PlayerCosmeticEquipEvent extends PlayerCosmeticEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancel = false; + private static final HandlerList HANDLER_LIST = new HandlerList(); + private Cosmetic cosmetic; + private boolean cancel = false; + public PlayerCosmeticEquipEvent(@NotNull CosmeticUser who, @NotNull Cosmetic cosmetic) { super(who); this.cosmetic = cosmetic; } /** - * Gets the {@link Cosmetic} being equipped in this event + * Gets the {@link Cosmetic} being equipped in this event. * - * @return The {@link Cosmetic} which is being equipped in this event + * @return the {@link Cosmetic} which is being equipped in this event */ @NotNull public Cosmetic getCosmetic() { @@ -30,9 +34,9 @@ public class PlayerCosmeticEquipEvent extends PlayerCosmeticEvent implements Can } /** - * Sets the {@link Cosmetic} that the player will equip + * Sets the {@link Cosmetic} that the player will equip. * - * @param cosmetic The {@link Cosmetic} that the player will equip + * @param cosmetic the {@link Cosmetic} that the player will equip */ public void setCosmetic(@NotNull Cosmetic cosmetic) { this.cosmetic = cosmetic; @@ -43,28 +47,17 @@ public class PlayerCosmeticEquipEvent extends PlayerCosmeticEvent implements Can return cancel; } - /** - * Sets the cancellation state of this event - * - *

- * Canceling this event will prevent the player from equipping the cosmetic - *

- * - * @param cancel true if you wish to cancel this event - */ @Override public void setCancelled(boolean cancel) { this.cancel = cancel; } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } From 2a0aa1593a9f27d30536fac66438615a8f0480dc Mon Sep 17 00:00:00 2001 From: Craftinators Date: Wed, 22 Jan 2025 11:00:10 -0500 Subject: [PATCH 06/10] docs(PlayerCosmeticEvent): add link to `CosmeticUser` --- .../hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEvent.java index b56b457b..b39bf73e 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEvent.java @@ -16,7 +16,7 @@ public abstract class PlayerCosmeticEvent extends PlayerEvent { } /** - * Returns the user involved in this event. + * Returns the {@link CosmeticUser} involved in this event. * * @return the user who is involved in this event */ From c591641754a797abea31665486a23ae2684d2be6 Mon Sep 17 00:00:00 2001 From: Craftinators Date: Wed, 22 Jan 2025 11:03:40 -0500 Subject: [PATCH 07/10] docs(PlayerCosmeticHideEvent): improve Javadocs --- .../api/events/PlayerCosmeticHideEvent.java | 34 +++++++------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticHideEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticHideEvent.java index 5276cd35..78e9bac1 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticHideEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticHideEvent.java @@ -6,25 +6,26 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** - * Called when cosmetics are hidden from a player + * Called when cosmetics are hidden from a player. */ public class PlayerCosmeticHideEvent extends PlayerCosmeticEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancel = false; + private static final HandlerList HANDLER_LIST = new HandlerList(); + private final CosmeticUser.HiddenReason reason; + private boolean cancel = false; + public PlayerCosmeticHideEvent(@NotNull CosmeticUser who, @NotNull CosmeticUser.HiddenReason reason) { super(who); this.reason = reason; } /** - * Gets the {@link CosmeticUser.HiddenReason} as to why cosmetics are being hidden for the player + * Gets the {@link CosmeticUser.HiddenReason} as to why cosmetics are being hidden for the player. * - * @return The {@link CosmeticUser.HiddenReason} why cosmetics are being hidden for the player + * @return the {@link CosmeticUser.HiddenReason} why cosmetics are being hidden for the player */ - @NotNull - public CosmeticUser.HiddenReason getReason() { + public @NotNull CosmeticUser.HiddenReason getReason() { return reason; } @@ -33,28 +34,17 @@ public class PlayerCosmeticHideEvent extends PlayerCosmeticEvent implements Canc return cancel; } - /** - * Sets the cancellation state of this event - * - *

- * Canceling this event will prevent the player from hiding cosmetics - *

- * - * @param cancel true if you wish to cancel this event - */ @Override public void setCancelled(boolean cancel) { this.cancel = cancel; } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } From e7b1fda73e433090c4e4b20fe99956180cdc3773 Mon Sep 17 00:00:00 2001 From: Craftinators Date: Wed, 22 Jan 2025 11:05:56 -0500 Subject: [PATCH 08/10] docs(PlayerCosmeticPostEquipEvent): improve Javadocs --- .../events/PlayerCosmeticPostEquipEvent.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java index 55b93234..d0fddf7d 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java @@ -5,8 +5,12 @@ import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; +/** + * Called when a player has equipped a {@link Cosmetic} + */ public class PlayerCosmeticPostEquipEvent extends PlayerCosmeticEvent { - private static final HandlerList handlers = new HandlerList(); + private static final HandlerList HANDLER_LIST = new HandlerList(); + private Cosmetic cosmetic; public PlayerCosmeticPostEquipEvent(@NotNull CosmeticUser who, @NotNull Cosmetic cosmetic) { @@ -15,32 +19,29 @@ public class PlayerCosmeticPostEquipEvent extends PlayerCosmeticEvent { } /** - * Gets the {@link Cosmetic} being equipped in this event + * Gets the {@link Cosmetic} being equipped in this event. * - * @return The {@link Cosmetic} which is being equipped in this event + * @return the {@link Cosmetic} which is being equipped in this event */ - @NotNull - public Cosmetic getCosmetic() { + public @NotNull Cosmetic getCosmetic() { return cosmetic; } /** - * Sets the {@link Cosmetic} that the player will equip + * Sets the {@link Cosmetic} that the player will equip. * - * @param cosmetic The {@link Cosmetic} that the player will equip + * @param cosmetic the {@link Cosmetic} that the player will equip */ public void setCosmetic(@NotNull Cosmetic cosmetic) { this.cosmetic = cosmetic; } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } From a0374874971cec1af33ccad6810973b8d9a2678e Mon Sep 17 00:00:00 2001 From: Craftinators Date: Wed, 22 Jan 2025 11:06:36 -0500 Subject: [PATCH 09/10] docs(PlayerCosmeticPostEquipEvent): add missing period --- .../hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java index d0fddf7d..552d1fc6 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java @@ -6,7 +6,7 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** - * Called when a player has equipped a {@link Cosmetic} + * Called when a player has equipped a {@link Cosmetic}. */ public class PlayerCosmeticPostEquipEvent extends PlayerCosmeticEvent { private static final HandlerList HANDLER_LIST = new HandlerList(); From 34237e0a45005f0da75098364f755c15120a2829 Mon Sep 17 00:00:00 2001 From: Craftinators Date: Wed, 22 Jan 2025 15:28:26 -0500 Subject: [PATCH 10/10] docs: Minor javadoc changes to most of the `api` directory --- .../api/events/PlayerCosmeticEquipEvent.java | 6 +-- .../api/events/PlayerCosmeticHideEvent.java | 2 +- .../events/PlayerCosmeticPostEquipEvent.java | 4 +- .../api/events/PlayerCosmeticRemoveEvent.java | 30 +++++-------- .../api/events/PlayerCosmeticShowEvent.java | 24 +++------- .../api/events/PlayerEmoteStartEvent.java | 35 ++++++--------- .../api/events/PlayerEmoteStopEvent.java | 36 ++++++--------- .../api/events/PlayerLoadEvent.java | 16 +++---- .../api/events/PlayerMenuCloseEvent.java | 14 +++--- .../api/events/PlayerMenuEvent.java | 11 +++-- .../api/events/PlayerMenuOpenEvent.java | 24 +++------- .../api/events/PlayerPreLoadEvent.java | 31 ++++++------- .../api/events/PlayerUnloadEvent.java | 17 ++++--- .../api/events/PlayerWardrobeEnterEvent.java | 44 ++++++++++--------- .../api/events/PlayerWardrobeLeaveEvent.java | 24 +++------- 15 files changed, 131 insertions(+), 187 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEquipEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEquipEvent.java index 606ff020..019535ab 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEquipEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticEquipEvent.java @@ -6,8 +6,6 @@ import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; -import java.util.List; - /** * Called when a player equips a {@link Cosmetic}. */ @@ -26,7 +24,7 @@ public class PlayerCosmeticEquipEvent extends PlayerCosmeticEvent implements Can /** * Gets the {@link Cosmetic} being equipped in this event. * - * @return the {@link Cosmetic} which is being equipped in this event + * @return the cosmetic which is being equipped in this event */ @NotNull public Cosmetic getCosmetic() { @@ -36,7 +34,7 @@ public class PlayerCosmeticEquipEvent extends PlayerCosmeticEvent implements Can /** * Sets the {@link Cosmetic} that the player will equip. * - * @param cosmetic the {@link Cosmetic} that the player will equip + * @param cosmetic the cosmetic that the player will equip */ public void setCosmetic(@NotNull Cosmetic cosmetic) { this.cosmetic = cosmetic; diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticHideEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticHideEvent.java index 78e9bac1..80cce646 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticHideEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticHideEvent.java @@ -23,7 +23,7 @@ public class PlayerCosmeticHideEvent extends PlayerCosmeticEvent implements Canc /** * Gets the {@link CosmeticUser.HiddenReason} as to why cosmetics are being hidden for the player. * - * @return the {@link CosmeticUser.HiddenReason} why cosmetics are being hidden for the player + * @return the reason why cosmetics are being hidden for the player */ public @NotNull CosmeticUser.HiddenReason getReason() { return reason; diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java index 552d1fc6..44880c10 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticPostEquipEvent.java @@ -21,7 +21,7 @@ public class PlayerCosmeticPostEquipEvent extends PlayerCosmeticEvent { /** * Gets the {@link Cosmetic} being equipped in this event. * - * @return the {@link Cosmetic} which is being equipped in this event + * @return the cosmetic which is being equipped in this event */ public @NotNull Cosmetic getCosmetic() { return cosmetic; @@ -30,7 +30,7 @@ public class PlayerCosmeticPostEquipEvent extends PlayerCosmeticEvent { /** * Sets the {@link Cosmetic} that the player will equip. * - * @param cosmetic the {@link Cosmetic} that the player will equip + * @param cosmetic the cosmetic that the player will equip */ public void setCosmetic(@NotNull Cosmetic cosmetic) { this.cosmetic = cosmetic; diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticRemoveEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticRemoveEvent.java index 80b47c44..e3016bdd 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticRemoveEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticRemoveEvent.java @@ -7,22 +7,24 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** - * Called when a player removes a cosmetic + * Called when a player removes a {@link Cosmetic}. */ public class PlayerCosmeticRemoveEvent extends PlayerCosmeticEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancel = false; + private static final HandlerList HANDLER_LIST = new HandlerList(); + private final Cosmetic cosmetic; + private boolean cancel = false; + public PlayerCosmeticRemoveEvent(@NotNull CosmeticUser who, @NotNull Cosmetic cosmetic) { super(who); this.cosmetic = cosmetic; } /** - * Gets the {@link Cosmetic} being removed in this event + * Gets the {@link Cosmetic} being removed in this event. * - * @return The {@link Cosmetic} which is being removed in this event + * @return the cosmetic which is being removed in this event */ public Cosmetic getCosmetic() { return cosmetic; @@ -33,27 +35,17 @@ public class PlayerCosmeticRemoveEvent extends PlayerCosmeticEvent implements Ca return cancel; } - /** - * Sets the cancellation state of this event - * - *

- * Canceling this event will prevent the player from removing the cosmetic - *

- * - * @param cancel true if you wish to cancel this event - */ @Override public void setCancelled(boolean cancel) { this.cancel = cancel; } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } \ No newline at end of file diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticShowEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticShowEvent.java index 892b4915..346904d2 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticShowEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerCosmeticShowEvent.java @@ -6,10 +6,11 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** - * Called when cosmetics are shown from a player + * Called when cosmetics are shown from a player. */ public class PlayerCosmeticShowEvent extends PlayerCosmeticEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); + private static final HandlerList HANDLER_LIST = new HandlerList(); + private boolean cancel = false; public PlayerCosmeticShowEvent(@NotNull CosmeticUser who) { @@ -21,28 +22,17 @@ public class PlayerCosmeticShowEvent extends PlayerCosmeticEvent implements Canc return cancel; } - /** - * Sets the cancellation state of this event - * - *

- * Canceling this event will prevent the player from showing cosmetics - *

- * - * @param cancel true if you wish to cancel this event - */ @Override public void setCancelled(boolean cancel) { this.cancel = cancel; } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } \ No newline at end of file diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerEmoteStartEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerEmoteStartEvent.java index 5844c489..0d541acc 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerEmoteStartEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerEmoteStartEvent.java @@ -6,23 +6,27 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** - * Called when a player starts playing an emote + * Called when a player starts playing an emote. */ public class PlayerEmoteStartEvent extends PlayerCosmeticEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancel = false; + private static final HandlerList HANDLER_LIST = new HandlerList(); + private final String animationId; + private boolean cancel = false; + public PlayerEmoteStartEvent(@NotNull CosmeticUser who, @NotNull String animationId) { super(who); this.animationId = animationId; } /** - * Gets the animation id of the emote the player started playing - * @implNote The returned string of this method may be an invalid animation id. Make sure to validate it before use + * Gets the animation id of the emote the player started playing. * - * @return The animation id of the emote which the player started playing + * @implNote The returned string of this method may be an invalid animation id. + * Make sure to validate it before use by calling {@link com.hibiscusmc.hmccosmetics.emotes.EmoteManager#get(String)}. + * + * @return the animation id of the emote which the player started playing */ @NotNull public String getAnimationId() { @@ -34,28 +38,17 @@ public class PlayerEmoteStartEvent extends PlayerCosmeticEvent implements Cancel return cancel; } - /** - * Sets the cancellation state of this event - * - *

- * Canceling this event will prevent the player from playing the emote - *

- * - * @param cancel true if you wish to cancel this event - */ @Override public void setCancelled(boolean cancel) { this.cancel = cancel; } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } \ No newline at end of file diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerEmoteStopEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerEmoteStopEvent.java index b17a833d..36bdea63 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerEmoteStopEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerEmoteStopEvent.java @@ -7,13 +7,15 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** - * Called when a player stops playing an emote + * Called when a player stops playing an emote. */ public class PlayerEmoteStopEvent extends PlayerCosmeticEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancel = false; + private static final HandlerList HANDLER_LIST = new HandlerList(); + private final UserEmoteManager.StopEmoteReason reason; + private boolean cancel = false; + public PlayerEmoteStopEvent(@NotNull CosmeticUser who, @NotNull UserEmoteManager.StopEmoteReason reason) { super(who); this.reason = reason; @@ -25,20 +27,19 @@ public class PlayerEmoteStopEvent extends PlayerCosmeticEvent implements Cancell * @return The {@link UserEmoteManager.StopEmoteReason} why the emote has stopped playing * @deprecated As of release 2.2.5+, replaced by {@link #getReason()} */ - @Deprecated + @Deprecated(forRemoval = true) @NotNull public UserEmoteManager.StopEmoteReason getStopEmoteReason() { return reason; } /** - * Gets the {@link UserEmoteManager.StopEmoteReason} as to why the emote has stopped playing + * Gets the {@link UserEmoteManager.StopEmoteReason} as to why the emote has stopped playing. * - * @return The {@link UserEmoteManager.StopEmoteReason} why the emote has stopped playing + * @return the reason why the emote has stopped playing * @since 2.2.5 */ - @NotNull - public UserEmoteManager.StopEmoteReason getReason() { + public @NotNull UserEmoteManager.StopEmoteReason getReason() { return reason; } @@ -47,28 +48,17 @@ public class PlayerEmoteStopEvent extends PlayerCosmeticEvent implements Cancell return cancel; } - /** - * Sets the cancellation state of this event - * - *

- * Canceling this event will prevent the player from stopping the emote - *

- * - * @param cancel true if you wish to cancel this event - */ @Override public void setCancelled(boolean cancel) { this.cancel = cancel; } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerLoadEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerLoadEvent.java index 3c3e51a0..228a1b98 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerLoadEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerLoadEvent.java @@ -4,22 +4,22 @@ import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; +/** + * Called when a player's cosmetic data is loaded. + */ public class PlayerLoadEvent extends PlayerCosmeticEvent { - - private static final HandlerList handlers = new HandlerList(); + private static final HandlerList HANDLER_LIST = new HandlerList(); public PlayerLoadEvent(@NotNull CosmeticUser who) { super(who); } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerMenuCloseEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerMenuCloseEvent.java index dec683bd..c365a6bf 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerMenuCloseEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerMenuCloseEvent.java @@ -6,23 +6,21 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** - * Called when a menu is closed by a player + * Called when a {@link Menu} is closed by a player. */ public class PlayerMenuCloseEvent extends PlayerMenuEvent { - private static final HandlerList handlers = new HandlerList(); + private static final HandlerList HANDLER_LIST = new HandlerList(); public PlayerMenuCloseEvent(@NotNull CosmeticUser who, @NotNull Menu menu) { super(who, menu); } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerMenuEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerMenuEvent.java index 001e7ad4..58baf692 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerMenuEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerMenuEvent.java @@ -5,10 +5,10 @@ import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import org.jetbrains.annotations.NotNull; /** - * Represents a menu related event + * Represents an event related to a player's interaction with a {@link Menu}. */ public abstract class PlayerMenuEvent extends PlayerCosmeticEvent { - protected Menu menu; + protected final Menu menu; public PlayerMenuEvent(@NotNull CosmeticUser who, @NotNull Menu menu) { super(who); @@ -16,12 +16,11 @@ public abstract class PlayerMenuEvent extends PlayerCosmeticEvent { } /** - * Gets the {@link Menu} involved with this event + * Gets the {@link Menu} involved with this event. * - * @return The {@link Menu} which is involved with the event + * @return the menu involved in this event */ - @NotNull - public final Menu getMenu() { + public @NotNull final Menu getMenu() { return menu; } } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerMenuOpenEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerMenuOpenEvent.java index dab19418..480096a8 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerMenuOpenEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerMenuOpenEvent.java @@ -7,10 +7,11 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** - * Called when a menu is opened by a player + * Called when a {@link Menu} is opened by a player. */ public class PlayerMenuOpenEvent extends PlayerMenuEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); + private static final HandlerList HANDLER_LIST = new HandlerList(); + private boolean cancel = false; public PlayerMenuOpenEvent(@NotNull CosmeticUser who, @NotNull Menu menu) { @@ -22,28 +23,17 @@ public class PlayerMenuOpenEvent extends PlayerMenuEvent implements Cancellable return cancel; } - /** - * Sets the cancellation state of this event - * - *

- * Canceling this event will prevent the player from opening a {@link Menu} - *

- * - * @param cancel true if you wish to cancel this event - */ @Override public void setCancelled(boolean cancel) { this.cancel = cancel; } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerPreLoadEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerPreLoadEvent.java index 929ace76..b007a6f3 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerPreLoadEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerPreLoadEvent.java @@ -1,36 +1,28 @@ package com.hibiscusmc.hmccosmetics.api.events; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; import java.util.UUID; /** - * Called before a player is loaded into the plugin (including before the plugin gets their data). - * This event is cancellable, and if cancelled, the player will not be loaded into the plugin. + * Called before a player's data is loaded into the plugin. + * + *

+ * If this event is cancelled, the player's data will not be loaded, + * and the player will not be able to interact with the plugin. + *

*/ public class PlayerPreLoadEvent extends PlayerEvent implements Cancellable { + private static final HandlerList HANDLER_LIST = new HandlerList(); - private static final HandlerList handlers = new HandlerList(); private boolean cancelled = false; public PlayerPreLoadEvent(@NotNull UUID id) { super(id); } - @Override - @NotNull - public HandlerList getHandlers() { - return handlers; - } - - @NotNull - public static HandlerList getHandlerList() { - return handlers; - } - @Override public boolean isCancelled() { return cancelled; @@ -40,4 +32,13 @@ public class PlayerPreLoadEvent extends PlayerEvent implements Cancellable { public void setCancelled(boolean cancel) { this.cancelled = cancel; } + + @Override + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; + } + + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; + } } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerUnloadEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerUnloadEvent.java index 17b25792..bb96d277 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerUnloadEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerUnloadEvent.java @@ -4,23 +4,22 @@ import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; +/** + * Called when a players data is unloaded from the plugin. This is called when a player leaves the server. + */ public class PlayerUnloadEvent extends PlayerCosmeticEvent { - - private static final HandlerList handlers = new HandlerList(); + private static final HandlerList HANDLER_LIST = new HandlerList(); public PlayerUnloadEvent(@NotNull CosmeticUser who) { super(who); } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } - } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerWardrobeEnterEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerWardrobeEnterEvent.java index d349d8f6..ebaeb6e6 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerWardrobeEnterEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerWardrobeEnterEvent.java @@ -2,19 +2,18 @@ package com.hibiscusmc.hmccosmetics.api.events; import com.hibiscusmc.hmccosmetics.config.Wardrobe; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; -import lombok.Getter; -import lombok.Setter; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** - * Called when a player enters their wardrobe + * Called when a player enters their {@link Wardrobe}. */ public class PlayerWardrobeEnterEvent extends PlayerCosmeticEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); + private static final HandlerList HANDLER_LIST = new HandlerList(); + private boolean cancel = false; - @Getter @Setter + private Wardrobe wardrobe; public PlayerWardrobeEnterEvent(@NotNull CosmeticUser who, @NotNull Wardrobe wardrobe) { @@ -22,33 +21,38 @@ public class PlayerWardrobeEnterEvent extends PlayerCosmeticEvent implements Can this.wardrobe = wardrobe; } + /** + * Get the {@link Wardrobe} the player is entering. + * @return The wardrobe being entered + */ + public Wardrobe getWardrobe() { + return wardrobe; + } + + /** + * Set the {@link Wardrobe} the player is entering. + * @param wardrobe the wardrobe being entered + */ + public void setWardrobe(Wardrobe wardrobe) { + this.wardrobe = wardrobe; + } + @Override public boolean isCancelled() { return cancel; } - /** - * Sets the cancellation state of this event - * - *

- * Canceling this event will prevent the player from entering their wardrobe - *

- * - * @param cancel true if you wish to cancel this event - */ @Override public void setCancelled(boolean cancel) { this.cancel = cancel; } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerWardrobeLeaveEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerWardrobeLeaveEvent.java index cd71bf39..378c2d41 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerWardrobeLeaveEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/events/PlayerWardrobeLeaveEvent.java @@ -6,10 +6,11 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** - * Called when a player leaves their wardrobe + * Called when a player leaves their {@link com.hibiscusmc.hmccosmetics.config.Wardrobe}. */ public class PlayerWardrobeLeaveEvent extends PlayerCosmeticEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); + private static final HandlerList HANDLER_LIST = new HandlerList(); + private boolean cancel = false; public PlayerWardrobeLeaveEvent(@NotNull CosmeticUser who) { @@ -21,28 +22,17 @@ public class PlayerWardrobeLeaveEvent extends PlayerCosmeticEvent implements Can return cancel; } - /** - * Sets the cancellation state of this event - * - *

- * Canceling this event will prevent the player from leaving their wardrobe - *

- * - * @param cancel true if you wish to cancel this event - */ @Override public void setCancelled(boolean cancel) { this.cancel = cancel; } @Override - @NotNull - public HandlerList getHandlers() { - return handlers; + public @NotNull HandlerList getHandlers() { + return HANDLER_LIST; } - @NotNull - public static HandlerList getHandlerList() { - return handlers; + public static @NotNull HandlerList getHandlerList() { + return HANDLER_LIST; } }