mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-21 07:59:28 +00:00
Fixed external spawning
This commit is contained in:
@@ -16,9 +16,10 @@ public class Illusioner implements IllusionerWrapper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityIllusionerWrapper adapt(org.bukkit.entity.Illusioner illusioner, Location location, double maxHealth, double attackDamage, String name) {
|
public EntityIllusionerWrapper adapt(org.bukkit.entity.Illusioner illusioner, Location location, double maxHealth, double attackDamage, String name) {
|
||||||
EntityIllusioner internalIllusioner = new EntityIllusioner(location, maxHealth, attackDamage, name);
|
if(illusioner instanceof CraftIllusioner) {
|
||||||
if(!(illusioner instanceof CraftIllusioner)) return null;
|
if(((CraftIllusioner) illusioner).getHandle() instanceof EntityIllusionerWrapper) return null;
|
||||||
((CraftIllusioner) illusioner).setHandle(internalIllusioner);
|
} else return null;
|
||||||
return internalIllusioner;
|
illusioner.remove();
|
||||||
|
return spawn(location, maxHealth, attackDamage, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ public class Illusioner implements IllusionerWrapper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityIllusionerWrapper adapt(org.bukkit.entity.Illusioner illusioner, Location location, double maxHealth, double attackDamage, String name) {
|
public EntityIllusionerWrapper adapt(org.bukkit.entity.Illusioner illusioner, Location location, double maxHealth, double attackDamage, String name) {
|
||||||
EntityIllusioner internalIllusioner = new EntityIllusioner(location, maxHealth, attackDamage, name);
|
if(illusioner instanceof CraftIllusioner) {
|
||||||
if(!(illusioner instanceof CraftIllusioner)) return null;
|
if(((CraftIllusioner) illusioner).getHandle() instanceof EntityIllusionerWrapper) return null;
|
||||||
((CraftIllusioner) illusioner).setHandle(internalIllusioner);
|
} else return null;
|
||||||
return internalIllusioner;
|
illusioner.remove();
|
||||||
|
return spawn(location, maxHealth, attackDamage, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ public class Illusioner implements IllusionerWrapper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityIllusionerWrapper adapt(org.bukkit.entity.Illusioner illusioner, Location location, double maxHealth, double attackDamage, String name) {
|
public EntityIllusionerWrapper adapt(org.bukkit.entity.Illusioner illusioner, Location location, double maxHealth, double attackDamage, String name) {
|
||||||
EntityIllusioner internalIllusioner = new EntityIllusioner(location, maxHealth, attackDamage, name);
|
if(illusioner instanceof CraftIllusioner) {
|
||||||
if(!(illusioner instanceof CraftIllusioner)) return null;
|
if(((CraftIllusioner) illusioner).getHandle() instanceof EntityIllusionerWrapper) return null;
|
||||||
((CraftIllusioner) illusioner).setHandle(internalIllusioner);
|
} else return null;
|
||||||
return internalIllusioner;
|
illusioner.remove();
|
||||||
|
return spawn(location, maxHealth, attackDamage, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.boss.BarColor;
|
import org.bukkit.boss.BarColor;
|
||||||
|
import org.bukkit.boss.BarFlag;
|
||||||
import org.bukkit.boss.BarStyle;
|
import org.bukkit.boss.BarStyle;
|
||||||
import org.bukkit.boss.BossBar;
|
import org.bukkit.boss.BossBar;
|
||||||
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
||||||
@@ -16,6 +17,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class EntityIllusioner extends EntityIllagerIllusioner implements EntityIllusionerWrapper {
|
public class EntityIllusioner extends EntityIllagerIllusioner implements EntityIllusionerWrapper {
|
||||||
private final String displayName;
|
private final String displayName;
|
||||||
|
private BossBar bossBar = null;
|
||||||
|
|
||||||
public EntityIllusioner(Location location, double maxHealth, double attackDamage, String name) {
|
public EntityIllusioner(Location location, double maxHealth, double attackDamage, String name) {
|
||||||
super(EntityTypes.ILLUSIONER, ((CraftWorld) location.getWorld()).getHandle());
|
super(EntityTypes.ILLUSIONER, ((CraftWorld) location.getWorld()).getHandle());
|
||||||
@@ -46,7 +48,9 @@ public class EntityIllusioner extends EntityIllagerIllusioner implements EntityI
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BossBar createBossbar(Plugin plugin, BarColor color, BarStyle style) {
|
public BossBar createBossbar(Plugin plugin, BarColor color, BarStyle style) {
|
||||||
BossBar bossBar = Bukkit.getServer().createBossBar(this.displayName, color, style);
|
if(bossBar != null) return bossBar;
|
||||||
|
BossBar bossBar = Bukkit.getServer().createBossBar(this.displayName, color, style, (BarFlag) null);
|
||||||
|
this.bossBar = bossBar;
|
||||||
Bukkit.getServer().getOnlinePlayers().forEach(bossBar::addPlayer);
|
Bukkit.getServer().getOnlinePlayers().forEach(bossBar::addPlayer);
|
||||||
LivingEntity entity = (LivingEntity) this.getBukkitEntity();
|
LivingEntity entity = (LivingEntity) this.getBukkitEntity();
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ public class Illusioner implements IllusionerWrapper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityIllusionerWrapper adapt(org.bukkit.entity.Illusioner illusioner, Location location, double maxHealth, double attackDamage, String name) {
|
public EntityIllusionerWrapper adapt(org.bukkit.entity.Illusioner illusioner, Location location, double maxHealth, double attackDamage, String name) {
|
||||||
EntityIllusioner internalIllusioner = new EntityIllusioner(location, maxHealth, attackDamage, name);
|
if(illusioner instanceof CraftIllusioner) {
|
||||||
if(!(illusioner instanceof CraftIllusioner)) return null;
|
if(((CraftIllusioner) illusioner).getHandle() instanceof EntityIllusionerWrapper) return null;
|
||||||
((CraftIllusioner) illusioner).setHandle(internalIllusioner);
|
} else return null;
|
||||||
return internalIllusioner;
|
illusioner.remove();
|
||||||
|
return spawn(location, maxHealth, attackDamage, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user