diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerWardrobeEnterEvent.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerWardrobeEnterEvent.java index 904642d2..f1b1c126 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerWardrobeEnterEvent.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/PlayerWardrobeEnterEvent.java @@ -1,5 +1,6 @@ package com.hibiscusmc.hmccosmetics.api; +import com.hibiscusmc.hmccosmetics.config.WardrobeLocation; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; @@ -11,9 +12,11 @@ import org.jetbrains.annotations.NotNull; public class PlayerWardrobeEnterEvent extends PlayerCosmeticEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); private boolean cancel = false; + private WardrobeLocation wardrobeLocation; - public PlayerWardrobeEnterEvent(@NotNull CosmeticUser who) { + public PlayerWardrobeEnterEvent(@NotNull CosmeticUser who, @NotNull WardrobeLocation wardrobeLocation) { super(who); + this.wardrobeLocation = wardrobeLocation; } @Override @@ -45,4 +48,12 @@ public class PlayerWardrobeEnterEvent extends PlayerCosmeticEvent implements Can public static HandlerList getHandlerList() { return handlers; } + + public void setWardrobeLocation(WardrobeLocation wardrobeLocation) { + this.wardrobeLocation = wardrobeLocation; + } + + public WardrobeLocation getWardrobeLocation() { + return wardrobeLocation; + } } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java index af949531..9a055a30 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java @@ -256,11 +256,12 @@ public class CosmeticUser { MessagesUtil.sendMessage(getPlayer(), "not-near-wardrobe"); return; } - PlayerWardrobeEnterEvent event = new PlayerWardrobeEnterEvent(this); + PlayerWardrobeEnterEvent event = new PlayerWardrobeEnterEvent(this, wardrobeLocation); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { return; } + wardrobeLocation = event.getWardrobeLocation(); if (userWardrobeManager == null) { userWardrobeManager = new UserWardrobeManager(this, wardrobeLocation);