diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerCosmeticHideEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerCosmeticHideEvent.java index 405aff02..13eb8749 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerCosmeticHideEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerCosmeticHideEvent.java @@ -2,48 +2,59 @@ package com.hibiscusmc.hmccosmetics.api; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; -public class PlayerCosmeticHideEvent extends Event implements Cancellable { - - private final CosmeticUser user; +/** + * Called when cosmetics are hidden from a player + */ +public class PlayerCosmeticHideEvent extends CosmeticUserEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean cancel = false; private final CosmeticUser.HiddenReason reason; - private boolean isCancelled; - public PlayerCosmeticHideEvent(CosmeticUser user, CosmeticUser.HiddenReason reason) { - this.user = user; + public PlayerCosmeticHideEvent(@NotNull CosmeticUser who, @NotNull CosmeticUser.HiddenReason reason) { + super(who); this.reason = reason; - this.isCancelled = false; + } + + /** + * 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 + */ + @NotNull + public CosmeticUser.HiddenReason getReason() { + return reason; } @Override public boolean isCancelled() { - return isCancelled; + 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) { - isCancelled = cancel; + this.cancel = cancel; } - private static final HandlerList handlers = new HandlerList(); - @Override @NotNull public HandlerList getHandlers() { return handlers; } + @NotNull public static HandlerList getHandlerList() { return handlers; } - - public CosmeticUser getUser() { - return user; - } - public CosmeticUser.HiddenReason getReason() { - return reason; - } }