mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-30 12:29:16 +00:00
feat: PlayerWardrobeEnterEvent now passes wardrobe location that is modifiable
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user