9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-19 15:09:19 +00:00

Merge pull request #159 from Craftinators/remapped

Javadoc changes to `api` directory
This commit is contained in:
LoJoSho
2025-01-22 14:52:54 -06:00
committed by GitHub
19 changed files with 209 additions and 274 deletions

View File

@@ -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.
* <p>
* For example, if a user specifies "test" in the config slot, and it is not a default cosmetic, this event will be
* triggered.
* </p>
*/
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.
* <p>
* This node is nested below the id in the configuration.
* </p>
*
* @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;
}
}

View File

@@ -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;
}
}

View File

@@ -7,22 +7,24 @@ import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* 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 cosmetic which is being equipped in this event
*/
@NotNull
public Cosmetic getCosmetic() {
@@ -30,9 +32,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 cosmetic that the player will equip
*/
public void setCosmetic(@NotNull Cosmetic cosmetic) {
this.cosmetic = cosmetic;
@@ -43,28 +45,17 @@ public class PlayerCosmeticEquipEvent extends PlayerCosmeticEvent implements Can
return cancel;
}
/**
* Sets the cancellation state of this event
*
* <p>
* Canceling this event will prevent the player from equipping the cosmetic
* </p>
*
* @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;
}
}

View File

@@ -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 {@link CosmeticUser} 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;
}
}

View File

@@ -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 reason 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
*
* <p>
* Canceling this event will prevent the player from hiding cosmetics
* </p>
*
* @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;
}
}

View File

@@ -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 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 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;
}
}

View File

@@ -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
*
* <p>
* Canceling this event will prevent the player from removing the cosmetic
* </p>
*
* @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;
}
}

View File

@@ -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
*
* <p>
* Canceling this event will prevent the player from showing cosmetics
* </p>
*
* @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;
}
}

View File

@@ -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
*
* <p>
* Canceling this event will prevent the player from playing the emote
* </p>
*
* @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;
}
}

View File

@@ -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
*
* <p>
* Canceling this event will prevent the player from stopping the emote
* </p>
*
* @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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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
*
* <p>
* Canceling this event will prevent the player from opening a {@link Menu}
* </p>
*
* @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;
}
}

View File

@@ -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.
*
* <p>
* 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.
* </p>
*/
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;
}
}

View File

@@ -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;
}
}

View File

@@ -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
*
* <p>
* Canceling this event will prevent the player from entering their wardrobe
* </p>
*
* @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;
}
}

View File

@@ -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
*
* <p>
* Canceling this event will prevent the player from leaving their wardrobe
* </p>
*
* @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;
}
}