mirror of
https://github.com/nkomarn/harbor.git
synced 2025-01-20 14:31:30 +01:00
Fix bossbar sticking on world change
This commit is contained in:
parent
76deb40cb0
commit
93b3a0424e
@ -13,6 +13,7 @@ import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -162,4 +163,9 @@ public class Messages implements Listener {
|
||||
public void onWorldLoad(@NotNull WorldLoadEvent event) {
|
||||
registerBar(event.getWorld());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onWorldChanged(PlayerChangedWorldEvent event) {
|
||||
Optional.ofNullable(bossBars.get(event.getFrom().getUID())).ifPresent(bossBar -> bossBar.removePlayer(event.getPlayer()));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user