diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerEmoteStopEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerEmoteStopEvent.java index 26610a89..abcd4bba 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerEmoteStopEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerEmoteStopEvent.java @@ -3,49 +3,69 @@ package com.hibiscusmc.hmccosmetics.api; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import com.hibiscusmc.hmccosmetics.user.manager.UserEmoteManager; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; -public class PlayerEmoteStopEvent extends Event implements Cancellable { +public class PlayerEmoteStopEvent extends CosmeticUserEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean cancel = false; + private final UserEmoteManager.StopEmoteReason reason; - private final CosmeticUser user; - private final UserEmoteManager.StopEmoteReason stopEmoteReason; - private boolean isCancelled; + public PlayerEmoteStopEvent(@NotNull CosmeticUser who, @NotNull UserEmoteManager.StopEmoteReason reason) { + super(who); + this.reason = reason; + } - public PlayerEmoteStopEvent(CosmeticUser user, UserEmoteManager.StopEmoteReason reason) { - this.user = user; - this.stopEmoteReason = reason; - this.isCancelled = false; + /** + * Gets the {@link UserEmoteManager.StopEmoteReason} as to why the emote has stopped playing + * + * @return The {@link UserEmoteManager.StopEmoteReason} why the emote has stopped playing + * @deprecated As of release 2.2.5+, replaced by {@link #getReason()} + */ + @Deprecated + @NotNull + public UserEmoteManager.StopEmoteReason getStopEmoteReason() { + return reason; + } + + /** + * Gets the {@link UserEmoteManager.StopEmoteReason} as to why the emote has stopped playing + * + * @return The {@link UserEmoteManager.StopEmoteReason} why the emote has stopped playing + * @since 2.2.5 + */ + @NotNull + public UserEmoteManager.StopEmoteReason 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 stopping the emote + *
+ * + * @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 UserEmoteManager.StopEmoteReason getStopEmoteReason() { - return stopEmoteReason; - } }