Fix bossbars wanting to stick around
This commit is contained in:
parent
6379ecaa8c
commit
6d1a68e2d7
@ -34,6 +34,8 @@ import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.logging.log4j.util.Strings;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.boss.KeyedBossBar;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -943,6 +945,19 @@ public class DisguiseUtilities {
|
||||
registerAllExtendedNames(board);
|
||||
registerNoName(board);
|
||||
}
|
||||
|
||||
Iterator<KeyedBossBar> bars = Bukkit.getBossBars();
|
||||
ArrayList<KeyedBossBar> barList = new ArrayList<>();
|
||||
bars.forEachRemaining(barList::add);
|
||||
|
||||
for (KeyedBossBar bar : barList) {
|
||||
if (!bar.getKey().getNamespace().equalsIgnoreCase("libsdisguises")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bar.removeAll();
|
||||
Bukkit.removeBossBar(bar.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isDisguiseInUse(Disguise disguise) {
|
||||
@ -2224,6 +2239,8 @@ public class DisguiseUtilities {
|
||||
case BAT:
|
||||
if (entity instanceof LivingEntity)
|
||||
return yMod + ((LivingEntity) entity).getEyeHeight();
|
||||
|
||||
return yMod;
|
||||
case MINECART:
|
||||
case MINECART_COMMAND:
|
||||
case MINECART_CHEST:
|
||||
|
Loading…
Reference in New Issue
Block a user