mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-19 23:19:22 +00:00
fix: balloon lead not properly disappearing when you unapply a balloon cosmetic
This commit is contained in:
@@ -99,7 +99,12 @@ public class UserBalloonManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void remove() {
|
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) {
|
if (balloonType == BalloonType.MODELENGINE) {
|
||||||
final ModeledEntity entity = ModelEngineAPI.getModeledEntity(modelEntity);
|
final ModeledEntity entity = ModelEngineAPI.getModeledEntity(modelEntity);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.user.manager;
|
package com.hibiscusmc.hmccosmetics.user.manager;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -39,6 +40,12 @@ public class UserBalloonPufferfish extends UserEntity {
|
|||||||
destroyed = true;
|
destroyed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void destroyPufferfish(List<Player> viewers) {
|
||||||
|
HMCCPacketManager.sendEntityDestroyPacket(pufferFishEntityId, viewers);
|
||||||
|
//getViewers().clear();
|
||||||
|
destroyed = true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Player> refreshViewers(Location location) {
|
public List<Player> refreshViewers(Location location) {
|
||||||
if (destroyed) return List.of(); //Prevents refreshing a destroyed entity
|
if (destroyed) return List.of(); //Prevents refreshing a destroyed entity
|
||||||
|
|||||||
Reference in New Issue
Block a user