From c395b68d6a134e6f026f3a87de9b37a032e01558 Mon Sep 17 00:00:00 2001 From: Craftinators Date: Wed, 15 Mar 2023 01:38:33 -0400 Subject: [PATCH] docs(PlayerCosmeticRemoveEvent): documented class --- .../api/PlayerCosmeticRemoveEvent.java | 48 +++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerCosmeticRemoveEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerCosmeticRemoveEvent.java index ab363363..79808deb 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerCosmeticRemoveEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerCosmeticRemoveEvent.java @@ -3,34 +3,50 @@ package com.hibiscusmc.hmccosmetics.api; import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic; 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 PlayerCosmeticRemoveEvent extends Event implements Cancellable { - - private final CosmeticUser user; +/** + * Called when a player removes a cosmetic + */ +public class PlayerCosmeticRemoveEvent extends CosmeticUserEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean cancel = false; private final Cosmetic cosmetic; - private boolean isCancelled; - public PlayerCosmeticRemoveEvent(CosmeticUser user, Cosmetic cosmetic) { - this.user = user; + public PlayerCosmeticRemoveEvent(@NotNull CosmeticUser who, @NotNull Cosmetic cosmetic) { + super(who); this.cosmetic = cosmetic; - this.isCancelled = false; + } + + /** + * Gets the {@link Cosmetic} being removed in this event + * + * @return The {@link Cosmetic} which is being removed in this event + */ + public Cosmetic getCosmetic() { + return cosmetic; } @Override public boolean isCancelled() { - return isCancelled; + 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) { - isCancelled = cancel; + this.cancel = cancel; } - private static final HandlerList handlers = new HandlerList(); - @Override @NotNull public HandlerList getHandlers() { @@ -40,12 +56,4 @@ public class PlayerCosmeticRemoveEvent extends Event implements Cancellable { public static HandlerList getHandlerList() { return handlers; } - - public CosmeticUser getUser() { - return user; - } - - public Cosmetic getCosmetic() { - return cosmetic; - } } \ No newline at end of file