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

chore: add more documentation to entering and leaving wardrobes

This commit is contained in:
LoJoSho
2025-01-10 14:14:02 -06:00
parent c3fcf760d7
commit 6636cc9548

View File

@@ -384,7 +384,22 @@ public class CosmeticUser {
return userWardrobeManager;
}
/**
* Use {@link #enterWardrobe(Wardrobe, boolean)} instead.
* @param ignoreDistance
* @param wardrobe
*/
@Deprecated(forRemoval = true, since = "2.7.5")
public void enterWardrobe(boolean ignoreDistance, @NotNull Wardrobe wardrobe) {
enterWardrobe(wardrobe, ignoreDistance);
}
/**
* This method is used to enter a wardrobe. You can listen to the {@link PlayerWardrobeEnterEvent} to cancel the event or modify any data.
* @param wardrobe The wardrobe to enter. Use {@link WardrobeSettings#getWardrobe(String)} to get pre-existing wardrobe or use your own by {@link Wardrobe}.
* @param ignoreDistance If true, the player can enter the wardrobe from any distance. If false, the player must be within the distance set in the wardrobe (If wardrobe has a distance of 0 or lower, the player can enter from any distance).
*/
public void enterWardrobe(@NotNull Wardrobe wardrobe, boolean ignoreDistance) {
if (wardrobe.hasPermission() && !getPlayer().hasPermission(wardrobe.getPermission())) {
MessagesUtil.sendMessage(getPlayer(), "no-permission");
return;
@@ -410,10 +425,18 @@ public class CosmeticUser {
}
}
/**
* Use {@link #leaveWardrobe(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "2.7.5")
public void leaveWardrobe() {
leaveWardrobe(false);
}
/**
* Causes the player to leave the wardrobe. If a player is not in the wardrobe, this will do nothing, use (@{@link #isInWardrobe()} to check if they are).
* @param ejected If true, the player was ejected from the wardrobe (Skips transition). If false, the player left the wardrobe normally.
*/
public void leaveWardrobe(boolean ejected) {
PlayerWardrobeLeaveEvent event = new PlayerWardrobeLeaveEvent(this);
Bukkit.getPluginManager().callEvent(event);
@@ -444,6 +467,10 @@ public class CosmeticUser {
}
}
/**
* This checks if the player is in a wardrobe. If they are, it will return true, else false. See {@link #getWardrobeManager()} to get the wardrobe manager.
* @return If the player is in a wardrobe.
*/
public boolean isInWardrobe() {
return userWardrobeManager != null;
}