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

fix: balloon lead not properly disappearing when you unapply a balloon cosmetic

This commit is contained in:
Logan
2025-08-17 16:22:32 -05:00
parent 937f66e8c5
commit 1ef7f4759f
2 changed files with 13 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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<Player> viewers) {
HMCCPacketManager.sendEntityDestroyPacket(pufferFishEntityId, viewers);
//getViewers().clear();
destroyed = true;
}
@Override
public List<Player> refreshViewers(Location location) {
if (destroyed) return List.of(); //Prevents refreshing a destroyed entity