9
0
mirror of https://github.com/Auxilor/EcoMobs.git synced 2025-12-22 16:39:25 +00:00

Fixed bossbars showing to the entire server

This commit is contained in:
Auxilor
2021-01-07 09:05:23 +00:00
parent 27267dd9c3
commit 5966f59b8d
4 changed files with 29 additions and 4 deletions

View File

@@ -26,6 +26,7 @@ import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
@@ -89,9 +90,14 @@ public class EntityIllusioner extends EntityIllagerIllusioner implements EntityI
}
BossBar bossBar = Bukkit.getServer().createBossBar(this.displayName, color, style, (BarFlag) null);
this.bossBar = bossBar;
Bukkit.getServer().getOnlinePlayers().forEach(bossBar::addPlayer);
LivingEntity entity = (LivingEntity) this.getBukkitEntity();
entity.getNearbyEntities(50, 50, 50).forEach(entity1 -> {
if (entity1 instanceof Player) {
bossBar.addPlayer((Player) entity1);
}
});
new BukkitRunnable() {
@Override
public void run() {

View File

@@ -27,6 +27,7 @@ import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.craftbukkit.v1_16_R1.CraftWorld;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
@@ -90,9 +91,14 @@ public class EntityIllusioner extends EntityIllagerIllusioner implements EntityI
}
BossBar bossBar = Bukkit.getServer().createBossBar(this.displayName, color, style, (BarFlag) null);
this.bossBar = bossBar;
Bukkit.getServer().getOnlinePlayers().forEach(bossBar::addPlayer);
LivingEntity entity = (LivingEntity) this.getBukkitEntity();
entity.getNearbyEntities(50, 50, 50).forEach(entity1 -> {
if (entity1 instanceof Player) {
bossBar.addPlayer((Player) entity1);
}
});
new BukkitRunnable() {
@Override
public void run() {

View File

@@ -27,6 +27,7 @@ import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
@@ -90,9 +91,14 @@ public class EntityIllusioner extends EntityIllagerIllusioner implements EntityI
}
BossBar bossBar = Bukkit.getServer().createBossBar(this.displayName, color, style, (BarFlag) null);
this.bossBar = bossBar;
Bukkit.getServer().getOnlinePlayers().forEach(bossBar::addPlayer);
LivingEntity entity = (LivingEntity) this.getBukkitEntity();
entity.getNearbyEntities(50, 50, 50).forEach(entity1 -> {
if (entity1 instanceof Player) {
bossBar.addPlayer((Player) entity1);
}
});
new BukkitRunnable() {
@Override
public void run() {

View File

@@ -26,6 +26,7 @@ import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
@@ -89,9 +90,15 @@ public class EntityIllusioner extends EntityIllagerIllusioner implements EntityI
}
BossBar bossBar = Bukkit.getServer().createBossBar(this.displayName, color, style, (BarFlag) null);
this.bossBar = bossBar;
Bukkit.getServer().getOnlinePlayers().forEach(bossBar::addPlayer);
LivingEntity entity = (LivingEntity) this.getBukkitEntity();
entity.getNearbyEntities(50, 50, 50).forEach(entity1 -> {
if (entity1 instanceof Player) {
bossBar.addPlayer((Player) entity1);
}
});
new BukkitRunnable() {
@Override
public void run() {