From 1ef7f4759f63cbab6085d9ee532bac47e2df315c Mon Sep 17 00:00:00 2001 From: Logan Date: Sun, 17 Aug 2025 16:22:32 -0500 Subject: [PATCH] fix: balloon lead not properly disappearing when you unapply a balloon cosmetic --- .../hmccosmetics/user/manager/UserBalloonManager.java | 7 ++++++- .../hmccosmetics/user/manager/UserBalloonPufferfish.java | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserBalloonManager.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserBalloonManager.java index 8269b95d..bc5b22c0 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserBalloonManager.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserBalloonManager.java @@ -99,7 +99,12 @@ public class UserBalloonManager { } public void remove() { - pufferfish.destroyPufferfish(); + // This code is like a brick road, always bumpy. + // Basically, the balloon viewers ignore people in wardrobe, which well, if your the user in the wardrobe, ain't including you. + // This manually passes in the viewers for it to destroy, which includes the person in the wardrobe + if (user.getPlayer() != null && user.isInWardrobe()) pufferfish.destroyPufferfish(List.of(user.getPlayer())); + else pufferfish.destroyPufferfish(); + if (balloonType == BalloonType.MODELENGINE) { final ModeledEntity entity = ModelEngineAPI.getModeledEntity(modelEntity); if (entity == null) { diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserBalloonPufferfish.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserBalloonPufferfish.java index 14c65ce5..2c813a67 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserBalloonPufferfish.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserBalloonPufferfish.java @@ -1,5 +1,6 @@ package com.hibiscusmc.hmccosmetics.user.manager; +import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin; import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager; import lombok.Getter; import org.bukkit.Location; @@ -39,6 +40,12 @@ public class UserBalloonPufferfish extends UserEntity { destroyed = true; } + public void destroyPufferfish(List viewers) { + HMCCPacketManager.sendEntityDestroyPacket(pufferFishEntityId, viewers); + //getViewers().clear(); + destroyed = true; + } + @Override public List refreshViewers(Location location) { if (destroyed) return List.of(); //Prevents refreshing a destroyed entity