mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-21 16:09:24 +00:00
Began conversion into ecobosses
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
package com.willfp.illusioner.proxy.v1_15_R1;
|
package com.willfp.ecobosses.proxy.v1_15_R1;
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.ecobosses.proxy.proxies.CustomIllusionerProxy;
|
||||||
import com.willfp.illusioner.illusioner.IllusionerManager;
|
|
||||||
import com.willfp.illusioner.proxy.proxies.EntityIllusionerProxy;
|
|
||||||
import net.minecraft.server.v1_15_R1.EntityHuman;
|
import net.minecraft.server.v1_15_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_15_R1.EntityIllagerIllusioner;
|
import net.minecraft.server.v1_15_R1.EntityIllagerIllusioner;
|
||||||
import net.minecraft.server.v1_15_R1.EntityIllagerWizard;
|
import net.minecraft.server.v1_15_R1.EntityIllagerWizard;
|
||||||
@@ -11,7 +9,6 @@ import net.minecraft.server.v1_15_R1.EntityIronGolem;
|
|||||||
import net.minecraft.server.v1_15_R1.EntityRaider;
|
import net.minecraft.server.v1_15_R1.EntityRaider;
|
||||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||||
import net.minecraft.server.v1_15_R1.EntityVillagerAbstract;
|
import net.minecraft.server.v1_15_R1.EntityVillagerAbstract;
|
||||||
import net.minecraft.server.v1_15_R1.GenericAttributes;
|
|
||||||
import net.minecraft.server.v1_15_R1.PathfinderGoalBowShoot;
|
import net.minecraft.server.v1_15_R1.PathfinderGoalBowShoot;
|
||||||
import net.minecraft.server.v1_15_R1.PathfinderGoalFloat;
|
import net.minecraft.server.v1_15_R1.PathfinderGoalFloat;
|
||||||
import net.minecraft.server.v1_15_R1.PathfinderGoalHurtByTarget;
|
import net.minecraft.server.v1_15_R1.PathfinderGoalHurtByTarget;
|
||||||
@@ -19,48 +16,25 @@ import net.minecraft.server.v1_15_R1.PathfinderGoalLookAtPlayer;
|
|||||||
import net.minecraft.server.v1_15_R1.PathfinderGoalMeleeAttack;
|
import net.minecraft.server.v1_15_R1.PathfinderGoalMeleeAttack;
|
||||||
import net.minecraft.server.v1_15_R1.PathfinderGoalNearestAttackableTarget;
|
import net.minecraft.server.v1_15_R1.PathfinderGoalNearestAttackableTarget;
|
||||||
import net.minecraft.server.v1_15_R1.PathfinderGoalRandomStroll;
|
import net.minecraft.server.v1_15_R1.PathfinderGoalRandomStroll;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.attribute.Attribute;
|
|
||||||
import org.bukkit.boss.BarFlag;
|
|
||||||
import org.bukkit.boss.BossBar;
|
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.util.CraftNamespacedKey;
|
import org.bukkit.craftbukkit.v1_15_R1.util.CraftNamespacedKey;
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class EntityIllusioner extends EntityIllagerIllusioner implements EntityIllusionerProxy {
|
public class CustomIllusioner extends EntityIllagerIllusioner implements CustomIllusionerProxy {
|
||||||
/**
|
/**
|
||||||
* The display name for the illusioner.
|
* Instantiate a new custom illusioner entity.
|
||||||
*/
|
|
||||||
private final String displayName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The boss bar linked to the illusioner.
|
|
||||||
*/
|
|
||||||
private BossBar bossBar = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiate a new illusioner entity.
|
|
||||||
*
|
*
|
||||||
* @param location The location to spawn it at.
|
* @param location The location to spawn it at.
|
||||||
*/
|
*/
|
||||||
public EntityIllusioner(@NotNull final Location location) {
|
public CustomIllusioner(@NotNull final Location location) {
|
||||||
super(EntityTypes.ILLUSIONER, ((CraftWorld) location.getWorld()).getHandle());
|
super(EntityTypes.ILLUSIONER, ((CraftWorld) location.getWorld()).getHandle());
|
||||||
|
|
||||||
this.getBukkitEntity().getPersistentDataContainer().set(CraftNamespacedKey.fromString("illusioner:illusioner"), PersistentDataType.INTEGER, 1);
|
this.getBukkitEntity().getPersistentDataContainer().set(CraftNamespacedKey.fromString("ecobosses:type"), PersistentDataType.STRING, "custom_illusioner");
|
||||||
|
|
||||||
this.displayName = IllusionerManager.OPTIONS.getName();
|
|
||||||
|
|
||||||
this.setPosition(location.getX(), location.getY(), location.getZ());
|
this.setPosition(location.getX(), location.getY(), location.getZ());
|
||||||
|
|
||||||
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(IllusionerManager.OPTIONS.getMaxHealth());
|
|
||||||
this.setHealth((float) IllusionerManager.OPTIONS.getMaxHealth());
|
|
||||||
|
|
||||||
this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(IllusionerManager.OPTIONS.getAttackDamage());
|
|
||||||
|
|
||||||
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
||||||
this.goalSelector.a(1, new EntityIllagerWizard.b());
|
this.goalSelector.a(1, new EntityIllagerWizard.b());
|
||||||
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
|
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
|
||||||
@@ -78,38 +52,9 @@ public class EntityIllusioner extends EntityIllagerIllusioner implements EntityI
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BossBar createBossbar(@NotNull final AbstractEcoPlugin plugin) {
|
public CustomIllusionerProxy spawn(@NotNull final Location location) {
|
||||||
if (bossBar != null) {
|
CustomIllusioner illusioner = new CustomIllusioner(location);
|
||||||
return bossBar;
|
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner);
|
||||||
}
|
return illusioner;
|
||||||
BossBar bossBar = Bukkit.getServer().createBossBar(this.displayName, IllusionerManager.OPTIONS.getColor(), IllusionerManager.OPTIONS.getStyle(), (BarFlag) null);
|
|
||||||
this.bossBar = bossBar;
|
|
||||||
|
|
||||||
LivingEntity entity = (LivingEntity) this.getBukkitEntity();
|
|
||||||
|
|
||||||
plugin.getRunnableFactory().create(runnable -> {
|
|
||||||
if (!entity.isDead()) {
|
|
||||||
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
|
||||||
entity.getNearbyEntities(50, 50, 50).forEach(entity1 -> {
|
|
||||||
if (entity1 instanceof Player) {
|
|
||||||
bossBar.addPlayer((Player) entity1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
runnable.cancel();
|
|
||||||
}
|
|
||||||
}).runTaskTimer(0, 40);
|
|
||||||
|
|
||||||
plugin.getRunnableFactory().create(runnable -> {
|
|
||||||
if (!entity.isDead()) {
|
|
||||||
bossBar.setProgress(entity.getHealth() / entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
|
||||||
} else {
|
|
||||||
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
|
||||||
bossBar.setVisible(false);
|
|
||||||
runnable.cancel();
|
|
||||||
}
|
|
||||||
}).runTaskTimer(0, 1);
|
|
||||||
|
|
||||||
return bossBar;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.willfp.illusioner.proxy.v1_15_R1;
|
|
||||||
|
|
||||||
import com.willfp.illusioner.proxy.proxies.EntityIllusionerProxy;
|
|
||||||
import com.willfp.illusioner.proxy.proxies.IllusionerHelperProxy;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftIllusioner;
|
|
||||||
import org.bukkit.entity.Illusioner;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public class IllusionerHelper implements IllusionerHelperProxy {
|
|
||||||
@Override
|
|
||||||
public EntityIllusionerProxy spawn(@NotNull final Location location) {
|
|
||||||
EntityIllusioner illusioner = new EntityIllusioner(location);
|
|
||||||
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner);
|
|
||||||
return illusioner;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityIllusionerProxy adapt(@NotNull final Illusioner illusioner) {
|
|
||||||
if (illusioner instanceof CraftIllusioner) {
|
|
||||||
if (((CraftIllusioner) illusioner).getHandle() instanceof EntityIllusionerProxy) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
illusioner.remove();
|
|
||||||
return spawn(illusioner.getLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.willfp.illusioner.proxy.v1_16_R1;
|
package com.willfp.ecobosses.proxy.v1_16_R1;
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.ecobosses.proxy.proxies.CustomIllusionerProxy;
|
||||||
import com.willfp.illusioner.illusioner.IllusionerManager;
|
|
||||||
import com.willfp.illusioner.proxy.proxies.EntityIllusionerProxy;
|
|
||||||
import net.minecraft.server.v1_16_R1.EntityHuman;
|
import net.minecraft.server.v1_16_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_16_R1.EntityIllagerIllusioner;
|
import net.minecraft.server.v1_16_R1.EntityIllagerIllusioner;
|
||||||
import net.minecraft.server.v1_16_R1.EntityIllagerWizard;
|
import net.minecraft.server.v1_16_R1.EntityIllagerWizard;
|
||||||
@@ -11,7 +9,6 @@ import net.minecraft.server.v1_16_R1.EntityIronGolem;
|
|||||||
import net.minecraft.server.v1_16_R1.EntityRaider;
|
import net.minecraft.server.v1_16_R1.EntityRaider;
|
||||||
import net.minecraft.server.v1_16_R1.EntityTypes;
|
import net.minecraft.server.v1_16_R1.EntityTypes;
|
||||||
import net.minecraft.server.v1_16_R1.EntityVillagerAbstract;
|
import net.minecraft.server.v1_16_R1.EntityVillagerAbstract;
|
||||||
import net.minecraft.server.v1_16_R1.GenericAttributes;
|
|
||||||
import net.minecraft.server.v1_16_R1.PathfinderGoalBowShoot;
|
import net.minecraft.server.v1_16_R1.PathfinderGoalBowShoot;
|
||||||
import net.minecraft.server.v1_16_R1.PathfinderGoalFloat;
|
import net.minecraft.server.v1_16_R1.PathfinderGoalFloat;
|
||||||
import net.minecraft.server.v1_16_R1.PathfinderGoalHurtByTarget;
|
import net.minecraft.server.v1_16_R1.PathfinderGoalHurtByTarget;
|
||||||
@@ -19,48 +16,25 @@ import net.minecraft.server.v1_16_R1.PathfinderGoalLookAtPlayer;
|
|||||||
import net.minecraft.server.v1_16_R1.PathfinderGoalMeleeAttack;
|
import net.minecraft.server.v1_16_R1.PathfinderGoalMeleeAttack;
|
||||||
import net.minecraft.server.v1_16_R1.PathfinderGoalNearestAttackableTarget;
|
import net.minecraft.server.v1_16_R1.PathfinderGoalNearestAttackableTarget;
|
||||||
import net.minecraft.server.v1_16_R1.PathfinderGoalRandomStroll;
|
import net.minecraft.server.v1_16_R1.PathfinderGoalRandomStroll;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.attribute.Attribute;
|
|
||||||
import org.bukkit.boss.BarFlag;
|
|
||||||
import org.bukkit.boss.BossBar;
|
|
||||||
import org.bukkit.craftbukkit.v1_16_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_16_R1.util.CraftNamespacedKey;
|
import org.bukkit.craftbukkit.v1_16_R1.util.CraftNamespacedKey;
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class EntityIllusioner extends EntityIllagerIllusioner implements EntityIllusionerProxy {
|
public class CustomIllusioner extends EntityIllagerIllusioner implements CustomIllusionerProxy {
|
||||||
/**
|
/**
|
||||||
* The display name for the illusioner.
|
* Instantiate a new custom illusioner entity.
|
||||||
*/
|
|
||||||
private final String displayName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The boss bar linked to the illusioner.
|
|
||||||
*/
|
|
||||||
private BossBar bossBar = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiate a new illusioner entity.
|
|
||||||
*
|
*
|
||||||
* @param location The location to spawn it at.
|
* @param location The location to spawn it at.
|
||||||
*/
|
*/
|
||||||
public EntityIllusioner(@NotNull final Location location) {
|
public CustomIllusioner(@NotNull final Location location) {
|
||||||
super(EntityTypes.ILLUSIONER, ((CraftWorld) location.getWorld()).getHandle());
|
super(EntityTypes.ILLUSIONER, ((CraftWorld) location.getWorld()).getHandle());
|
||||||
|
|
||||||
this.getBukkitEntity().getPersistentDataContainer().set(CraftNamespacedKey.fromString("illusioner:illusioner"), PersistentDataType.INTEGER, 1);
|
this.getBukkitEntity().getPersistentDataContainer().set(CraftNamespacedKey.fromString("ecobosses:type"), PersistentDataType.STRING, "custom_illusioner");
|
||||||
|
|
||||||
this.displayName = IllusionerManager.OPTIONS.getName();
|
|
||||||
|
|
||||||
this.setPosition(location.getX(), location.getY(), location.getZ());
|
this.setPosition(location.getX(), location.getY(), location.getZ());
|
||||||
|
|
||||||
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(IllusionerManager.OPTIONS.getMaxHealth());
|
|
||||||
this.setHealth((float) IllusionerManager.OPTIONS.getMaxHealth());
|
|
||||||
|
|
||||||
this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(IllusionerManager.OPTIONS.getAttackDamage());
|
|
||||||
|
|
||||||
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
||||||
this.goalSelector.a(1, new EntityIllagerWizard.b());
|
this.goalSelector.a(1, new EntityIllagerWizard.b());
|
||||||
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
|
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
|
||||||
@@ -78,38 +52,9 @@ public class EntityIllusioner extends EntityIllagerIllusioner implements EntityI
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BossBar createBossbar(@NotNull final AbstractEcoPlugin plugin) {
|
public CustomIllusionerProxy spawn(@NotNull final Location location) {
|
||||||
if (bossBar != null) {
|
CustomIllusioner illusioner = new CustomIllusioner(location);
|
||||||
return bossBar;
|
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner);
|
||||||
}
|
return illusioner;
|
||||||
BossBar bossBar = Bukkit.getServer().createBossBar(this.displayName, IllusionerManager.OPTIONS.getColor(), IllusionerManager.OPTIONS.getStyle(), (BarFlag) null);
|
|
||||||
this.bossBar = bossBar;
|
|
||||||
|
|
||||||
LivingEntity entity = (LivingEntity) this.getBukkitEntity();
|
|
||||||
|
|
||||||
plugin.getRunnableFactory().create(runnable -> {
|
|
||||||
if (!entity.isDead()) {
|
|
||||||
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
|
||||||
entity.getNearbyEntities(50, 50, 50).forEach(entity1 -> {
|
|
||||||
if (entity1 instanceof Player) {
|
|
||||||
bossBar.addPlayer((Player) entity1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
runnable.cancel();
|
|
||||||
}
|
|
||||||
}).runTaskTimer(0, 40);
|
|
||||||
|
|
||||||
plugin.getRunnableFactory().create(runnable -> {
|
|
||||||
if (!entity.isDead()) {
|
|
||||||
bossBar.setProgress(entity.getHealth() / entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
|
||||||
} else {
|
|
||||||
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
|
||||||
bossBar.setVisible(false);
|
|
||||||
runnable.cancel();
|
|
||||||
}
|
|
||||||
}).runTaskTimer(0, 1);
|
|
||||||
|
|
||||||
return bossBar;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.willfp.illusioner.proxy.v1_16_R1;
|
|
||||||
|
|
||||||
import com.willfp.illusioner.proxy.proxies.EntityIllusionerProxy;
|
|
||||||
import com.willfp.illusioner.proxy.proxies.IllusionerHelperProxy;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.craftbukkit.v1_16_R1.CraftWorld;
|
|
||||||
import org.bukkit.craftbukkit.v1_16_R1.entity.CraftIllusioner;
|
|
||||||
import org.bukkit.entity.Illusioner;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public class IllusionerHelper implements IllusionerHelperProxy {
|
|
||||||
@Override
|
|
||||||
public EntityIllusionerProxy spawn(@NotNull final Location location) {
|
|
||||||
EntityIllusioner illusioner = new EntityIllusioner(location);
|
|
||||||
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner);
|
|
||||||
return illusioner;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityIllusionerProxy adapt(@NotNull final Illusioner illusioner) {
|
|
||||||
if (illusioner instanceof CraftIllusioner) {
|
|
||||||
if (((CraftIllusioner) illusioner).getHandle() instanceof EntityIllusionerProxy) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
illusioner.remove();
|
|
||||||
return spawn(illusioner.getLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.willfp.illusioner.proxy.v1_16_R2;
|
package com.willfp.ecobosses.proxy.v1_16_R2;
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.ecobosses.proxy.proxies.CustomIllusionerProxy;
|
||||||
import com.willfp.illusioner.illusioner.IllusionerManager;
|
|
||||||
import com.willfp.illusioner.proxy.proxies.EntityIllusionerProxy;
|
|
||||||
import net.minecraft.server.v1_16_R2.EntityHuman;
|
import net.minecraft.server.v1_16_R2.EntityHuman;
|
||||||
import net.minecraft.server.v1_16_R2.EntityIllagerIllusioner;
|
import net.minecraft.server.v1_16_R2.EntityIllagerIllusioner;
|
||||||
import net.minecraft.server.v1_16_R2.EntityIllagerWizard;
|
import net.minecraft.server.v1_16_R2.EntityIllagerWizard;
|
||||||
@@ -11,7 +9,6 @@ import net.minecraft.server.v1_16_R2.EntityIronGolem;
|
|||||||
import net.minecraft.server.v1_16_R2.EntityRaider;
|
import net.minecraft.server.v1_16_R2.EntityRaider;
|
||||||
import net.minecraft.server.v1_16_R2.EntityTypes;
|
import net.minecraft.server.v1_16_R2.EntityTypes;
|
||||||
import net.minecraft.server.v1_16_R2.EntityVillagerAbstract;
|
import net.minecraft.server.v1_16_R2.EntityVillagerAbstract;
|
||||||
import net.minecraft.server.v1_16_R2.GenericAttributes;
|
|
||||||
import net.minecraft.server.v1_16_R2.PathfinderGoalBowShoot;
|
import net.minecraft.server.v1_16_R2.PathfinderGoalBowShoot;
|
||||||
import net.minecraft.server.v1_16_R2.PathfinderGoalFloat;
|
import net.minecraft.server.v1_16_R2.PathfinderGoalFloat;
|
||||||
import net.minecraft.server.v1_16_R2.PathfinderGoalHurtByTarget;
|
import net.minecraft.server.v1_16_R2.PathfinderGoalHurtByTarget;
|
||||||
@@ -19,48 +16,25 @@ import net.minecraft.server.v1_16_R2.PathfinderGoalLookAtPlayer;
|
|||||||
import net.minecraft.server.v1_16_R2.PathfinderGoalMeleeAttack;
|
import net.minecraft.server.v1_16_R2.PathfinderGoalMeleeAttack;
|
||||||
import net.minecraft.server.v1_16_R2.PathfinderGoalNearestAttackableTarget;
|
import net.minecraft.server.v1_16_R2.PathfinderGoalNearestAttackableTarget;
|
||||||
import net.minecraft.server.v1_16_R2.PathfinderGoalRandomStroll;
|
import net.minecraft.server.v1_16_R2.PathfinderGoalRandomStroll;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.attribute.Attribute;
|
|
||||||
import org.bukkit.boss.BarFlag;
|
|
||||||
import org.bukkit.boss.BossBar;
|
|
||||||
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_16_R2.util.CraftNamespacedKey;
|
import org.bukkit.craftbukkit.v1_16_R2.util.CraftNamespacedKey;
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class EntityIllusioner extends EntityIllagerIllusioner implements EntityIllusionerProxy {
|
public class CustomIllusioner extends EntityIllagerIllusioner implements CustomIllusionerProxy {
|
||||||
/**
|
/**
|
||||||
* The display name for the illusioner.
|
* Instantiate a new custom illusioner entity.
|
||||||
*/
|
|
||||||
private final String displayName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The boss bar linked to the illusioner.
|
|
||||||
*/
|
|
||||||
private BossBar bossBar = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiate a new illusioner entity.
|
|
||||||
*
|
*
|
||||||
* @param location The location to spawn it at.
|
* @param location The location to spawn it at.
|
||||||
*/
|
*/
|
||||||
public EntityIllusioner(@NotNull final Location location) {
|
public CustomIllusioner(@NotNull final Location location) {
|
||||||
super(EntityTypes.ILLUSIONER, ((CraftWorld) location.getWorld()).getHandle());
|
super(EntityTypes.ILLUSIONER, ((CraftWorld) location.getWorld()).getHandle());
|
||||||
|
|
||||||
this.getBukkitEntity().getPersistentDataContainer().set(CraftNamespacedKey.fromString("illusioner:illusioner"), PersistentDataType.INTEGER, 1);
|
this.getBukkitEntity().getPersistentDataContainer().set(CraftNamespacedKey.fromString("ecobosses:type"), PersistentDataType.STRING, "custom_illusioner");
|
||||||
|
|
||||||
this.displayName = IllusionerManager.OPTIONS.getName();
|
|
||||||
|
|
||||||
this.setPosition(location.getX(), location.getY(), location.getZ());
|
this.setPosition(location.getX(), location.getY(), location.getZ());
|
||||||
|
|
||||||
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(IllusionerManager.OPTIONS.getMaxHealth());
|
|
||||||
this.setHealth((float) IllusionerManager.OPTIONS.getMaxHealth());
|
|
||||||
|
|
||||||
this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(IllusionerManager.OPTIONS.getAttackDamage());
|
|
||||||
|
|
||||||
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
||||||
this.goalSelector.a(1, new EntityIllagerWizard.b());
|
this.goalSelector.a(1, new EntityIllagerWizard.b());
|
||||||
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
|
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
|
||||||
@@ -78,38 +52,9 @@ public class EntityIllusioner extends EntityIllagerIllusioner implements EntityI
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BossBar createBossbar(@NotNull final AbstractEcoPlugin plugin) {
|
public CustomIllusionerProxy spawn(@NotNull final Location location) {
|
||||||
if (bossBar != null) {
|
CustomIllusioner illusioner = new CustomIllusioner(location);
|
||||||
return bossBar;
|
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner);
|
||||||
}
|
return illusioner;
|
||||||
BossBar bossBar = Bukkit.getServer().createBossBar(this.displayName, IllusionerManager.OPTIONS.getColor(), IllusionerManager.OPTIONS.getStyle(), (BarFlag) null);
|
|
||||||
this.bossBar = bossBar;
|
|
||||||
|
|
||||||
LivingEntity entity = (LivingEntity) this.getBukkitEntity();
|
|
||||||
|
|
||||||
plugin.getRunnableFactory().create(runnable -> {
|
|
||||||
if (!entity.isDead()) {
|
|
||||||
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
|
||||||
entity.getNearbyEntities(50, 50, 50).forEach(entity1 -> {
|
|
||||||
if (entity1 instanceof Player) {
|
|
||||||
bossBar.addPlayer((Player) entity1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
runnable.cancel();
|
|
||||||
}
|
|
||||||
}).runTaskTimer(0, 40);
|
|
||||||
|
|
||||||
plugin.getRunnableFactory().create(runnable -> {
|
|
||||||
if (!entity.isDead()) {
|
|
||||||
bossBar.setProgress(entity.getHealth() / entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
|
||||||
} else {
|
|
||||||
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
|
||||||
bossBar.setVisible(false);
|
|
||||||
runnable.cancel();
|
|
||||||
}
|
|
||||||
}).runTaskTimer(0, 1);
|
|
||||||
|
|
||||||
return bossBar;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.willfp.illusioner.proxy.v1_16_R2;
|
|
||||||
|
|
||||||
import com.willfp.illusioner.proxy.proxies.EntityIllusionerProxy;
|
|
||||||
import com.willfp.illusioner.proxy.proxies.IllusionerHelperProxy;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
|
|
||||||
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftIllusioner;
|
|
||||||
import org.bukkit.entity.Illusioner;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public class IllusionerHelper implements IllusionerHelperProxy {
|
|
||||||
@Override
|
|
||||||
public EntityIllusionerProxy spawn(@NotNull final Location location) {
|
|
||||||
EntityIllusioner illusioner = new EntityIllusioner(location);
|
|
||||||
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner);
|
|
||||||
return illusioner;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityIllusionerProxy adapt(@NotNull final Illusioner illusioner) {
|
|
||||||
if (illusioner instanceof CraftIllusioner) {
|
|
||||||
if (((CraftIllusioner) illusioner).getHandle() instanceof EntityIllusionerProxy) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
illusioner.remove();
|
|
||||||
return spawn(illusioner.getLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.willfp.illusioner.proxy.v1_16_R3;
|
package com.willfp.ecobosses.proxy.v1_16_R3;
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.ecobosses.proxy.proxies.CustomIllusionerProxy;
|
||||||
import com.willfp.illusioner.illusioner.IllusionerManager;
|
|
||||||
import com.willfp.illusioner.proxy.proxies.EntityIllusionerProxy;
|
|
||||||
import net.minecraft.server.v1_16_R3.EntityHuman;
|
import net.minecraft.server.v1_16_R3.EntityHuman;
|
||||||
import net.minecraft.server.v1_16_R3.EntityIllagerIllusioner;
|
import net.minecraft.server.v1_16_R3.EntityIllagerIllusioner;
|
||||||
import net.minecraft.server.v1_16_R3.EntityIllagerWizard;
|
import net.minecraft.server.v1_16_R3.EntityIllagerWizard;
|
||||||
@@ -11,7 +9,6 @@ import net.minecraft.server.v1_16_R3.EntityIronGolem;
|
|||||||
import net.minecraft.server.v1_16_R3.EntityRaider;
|
import net.minecraft.server.v1_16_R3.EntityRaider;
|
||||||
import net.minecraft.server.v1_16_R3.EntityTypes;
|
import net.minecraft.server.v1_16_R3.EntityTypes;
|
||||||
import net.minecraft.server.v1_16_R3.EntityVillagerAbstract;
|
import net.minecraft.server.v1_16_R3.EntityVillagerAbstract;
|
||||||
import net.minecraft.server.v1_16_R3.GenericAttributes;
|
|
||||||
import net.minecraft.server.v1_16_R3.PathfinderGoalBowShoot;
|
import net.minecraft.server.v1_16_R3.PathfinderGoalBowShoot;
|
||||||
import net.minecraft.server.v1_16_R3.PathfinderGoalFloat;
|
import net.minecraft.server.v1_16_R3.PathfinderGoalFloat;
|
||||||
import net.minecraft.server.v1_16_R3.PathfinderGoalHurtByTarget;
|
import net.minecraft.server.v1_16_R3.PathfinderGoalHurtByTarget;
|
||||||
@@ -19,48 +16,25 @@ import net.minecraft.server.v1_16_R3.PathfinderGoalLookAtPlayer;
|
|||||||
import net.minecraft.server.v1_16_R3.PathfinderGoalMeleeAttack;
|
import net.minecraft.server.v1_16_R3.PathfinderGoalMeleeAttack;
|
||||||
import net.minecraft.server.v1_16_R3.PathfinderGoalNearestAttackableTarget;
|
import net.minecraft.server.v1_16_R3.PathfinderGoalNearestAttackableTarget;
|
||||||
import net.minecraft.server.v1_16_R3.PathfinderGoalRandomStroll;
|
import net.minecraft.server.v1_16_R3.PathfinderGoalRandomStroll;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.attribute.Attribute;
|
|
||||||
import org.bukkit.boss.BarFlag;
|
|
||||||
import org.bukkit.boss.BossBar;
|
|
||||||
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_16_R3.util.CraftNamespacedKey;
|
import org.bukkit.craftbukkit.v1_16_R3.util.CraftNamespacedKey;
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class EntityIllusioner extends EntityIllagerIllusioner implements EntityIllusionerProxy {
|
public class CustomIllusioner extends EntityIllagerIllusioner implements CustomIllusionerProxy {
|
||||||
/**
|
/**
|
||||||
* The display name for the illusioner.
|
* Instantiate a new custom illusioner entity.
|
||||||
*/
|
|
||||||
private final String displayName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The boss bar linked to the illusioner.
|
|
||||||
*/
|
|
||||||
private BossBar bossBar = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiate a new illusioner entity.
|
|
||||||
*
|
*
|
||||||
* @param location The location to spawn it at.
|
* @param location The location to spawn it at.
|
||||||
*/
|
*/
|
||||||
public EntityIllusioner(@NotNull final Location location) {
|
public CustomIllusioner(@NotNull final Location location) {
|
||||||
super(EntityTypes.ILLUSIONER, ((CraftWorld) location.getWorld()).getHandle());
|
super(EntityTypes.ILLUSIONER, ((CraftWorld) location.getWorld()).getHandle());
|
||||||
|
|
||||||
this.getBukkitEntity().getPersistentDataContainer().set(CraftNamespacedKey.fromString("illusioner:illusioner"), PersistentDataType.INTEGER, 1);
|
this.getBukkitEntity().getPersistentDataContainer().set(CraftNamespacedKey.fromString("ecobosses:type"), PersistentDataType.STRING, "custom_illusioner");
|
||||||
|
|
||||||
this.displayName = IllusionerManager.OPTIONS.getName();
|
|
||||||
|
|
||||||
this.setPosition(location.getX(), location.getY(), location.getZ());
|
this.setPosition(location.getX(), location.getY(), location.getZ());
|
||||||
|
|
||||||
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(IllusionerManager.OPTIONS.getMaxHealth());
|
|
||||||
this.setHealth((float) IllusionerManager.OPTIONS.getMaxHealth());
|
|
||||||
|
|
||||||
this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(IllusionerManager.OPTIONS.getAttackDamage());
|
|
||||||
|
|
||||||
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
||||||
this.goalSelector.a(1, new EntityIllagerWizard.b());
|
this.goalSelector.a(1, new EntityIllagerWizard.b());
|
||||||
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
|
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
|
||||||
@@ -78,38 +52,9 @@ public class EntityIllusioner extends EntityIllagerIllusioner implements EntityI
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BossBar createBossbar(@NotNull final AbstractEcoPlugin plugin) {
|
public CustomIllusionerProxy spawn(@NotNull final Location location) {
|
||||||
if (bossBar != null) {
|
CustomIllusioner illusioner = new CustomIllusioner(location);
|
||||||
return bossBar;
|
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner);
|
||||||
}
|
return illusioner;
|
||||||
BossBar bossBar = Bukkit.getServer().createBossBar(this.displayName, IllusionerManager.OPTIONS.getColor(), IllusionerManager.OPTIONS.getStyle(), (BarFlag) null);
|
|
||||||
this.bossBar = bossBar;
|
|
||||||
|
|
||||||
LivingEntity entity = (LivingEntity) this.getBukkitEntity();
|
|
||||||
|
|
||||||
plugin.getRunnableFactory().create(runnable -> {
|
|
||||||
if (!entity.isDead()) {
|
|
||||||
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
|
||||||
entity.getNearbyEntities(50, 50, 50).forEach(entity1 -> {
|
|
||||||
if (entity1 instanceof Player) {
|
|
||||||
bossBar.addPlayer((Player) entity1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
runnable.cancel();
|
|
||||||
}
|
|
||||||
}).runTaskTimer(0, 40);
|
|
||||||
|
|
||||||
plugin.getRunnableFactory().create(runnable -> {
|
|
||||||
if (!entity.isDead()) {
|
|
||||||
bossBar.setProgress(entity.getHealth() / entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
|
||||||
} else {
|
|
||||||
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
|
||||||
bossBar.setVisible(false);
|
|
||||||
runnable.cancel();
|
|
||||||
}
|
|
||||||
}).runTaskTimer(0, 1);
|
|
||||||
|
|
||||||
return bossBar;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.willfp.illusioner.proxy.v1_16_R3;
|
|
||||||
|
|
||||||
import com.willfp.illusioner.proxy.proxies.EntityIllusionerProxy;
|
|
||||||
import com.willfp.illusioner.proxy.proxies.IllusionerHelperProxy;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
|
||||||
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftIllusioner;
|
|
||||||
import org.bukkit.entity.Illusioner;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public class IllusionerHelper implements IllusionerHelperProxy {
|
|
||||||
@Override
|
|
||||||
public EntityIllusionerProxy spawn(@NotNull final Location location) {
|
|
||||||
EntityIllusioner illusioner = new EntityIllusioner(location);
|
|
||||||
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner);
|
|
||||||
return illusioner;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityIllusionerProxy adapt(@NotNull final Illusioner illusioner) {
|
|
||||||
if (illusioner instanceof CraftIllusioner) {
|
|
||||||
if (((CraftIllusioner) illusioner).getHandle() instanceof EntityIllusionerProxy) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
illusioner.remove();
|
|
||||||
return spawn(illusioner.getLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
package com.willfp.illusioner;
|
package com.willfp.ecobosses;
|
||||||
|
|
||||||
import com.willfp.eco.util.command.AbstractCommand;
|
import com.willfp.eco.util.command.AbstractCommand;
|
||||||
import com.willfp.eco.util.display.DisplayModule;
|
import com.willfp.eco.util.display.DisplayModule;
|
||||||
import com.willfp.eco.util.integrations.IntegrationLoader;
|
import com.willfp.eco.util.integrations.IntegrationLoader;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||||
import com.willfp.illusioner.commands.CommandIldrop;
|
import com.willfp.ecobosses.commands.CommandEbdrop;
|
||||||
import com.willfp.illusioner.commands.CommandIlreload;
|
import com.willfp.ecobosses.commands.CommandEbreload;
|
||||||
import com.willfp.illusioner.config.IllusionerConfigs;
|
import com.willfp.ecobosses.config.EcoBossesConfigs;
|
||||||
import com.willfp.illusioner.illusioner.IllusionerManager;
|
import com.willfp.ecobosses.bosses.listeners.AttackListeners;
|
||||||
import com.willfp.illusioner.illusioner.listeners.AttackListeners;
|
import com.willfp.ecobosses.bosses.listeners.DeathListeners;
|
||||||
import com.willfp.illusioner.illusioner.listeners.DeathListeners;
|
import com.willfp.ecobosses.bosses.listeners.SpawnListeners;
|
||||||
import com.willfp.illusioner.illusioner.listeners.SpawnListeners;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -21,18 +20,18 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class IllusionerPlugin extends AbstractEcoPlugin {
|
public class EcoBossesPlugin extends AbstractEcoPlugin {
|
||||||
/**
|
/**
|
||||||
* Instance of the plugin.
|
* Instance of the plugin.
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private static IllusionerPlugin instance;
|
private static EcoBossesPlugin instance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal constructor called by bukkit on plugin load.
|
* Internal constructor called by bukkit on plugin load.
|
||||||
*/
|
*/
|
||||||
public IllusionerPlugin() {
|
public EcoBossesPlugin() {
|
||||||
super("Illusioner", 86576, 9596, "com.willfp.illusioner.proxy", "&9");
|
super("EcoBosses", 86576, 9596, "com.willfp.ecobosses.proxy", "&9");
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,8 +93,8 @@ public class IllusionerPlugin extends AbstractEcoPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public List<AbstractCommand> getCommands() {
|
public List<AbstractCommand> getCommands() {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
new CommandIlreload(this),
|
new CommandEbreload(this),
|
||||||
new CommandIldrop(this)
|
new CommandEbdrop(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +125,7 @@ public class IllusionerPlugin extends AbstractEcoPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public List<Class<?>> getUpdatableClasses() {
|
public List<Class<?>> getUpdatableClasses() {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
IllusionerConfigs.class
|
EcoBossesConfigs.class
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package com.willfp.ecobosses.bosses;
|
||||||
|
|
||||||
|
public class EcoBoss {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
package com.willfp.illusioner.illusioner.listeners;
|
package com.willfp.ecobosses.bosses.listeners;
|
||||||
|
|
||||||
import com.willfp.eco.util.NumberUtils;
|
import com.willfp.eco.util.NumberUtils;
|
||||||
import com.willfp.illusioner.illusioner.IllusionerManager;
|
import com.willfp.ecobosses.bosses.util.OptionedSound;
|
||||||
import com.willfp.illusioner.illusioner.OptionedSound;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
package com.willfp.illusioner.illusioner.listeners;
|
package com.willfp.ecobosses.bosses.listeners;
|
||||||
|
|
||||||
|
|
||||||
import com.willfp.eco.util.drops.DropQueue;
|
|
||||||
import com.willfp.eco.util.events.entitydeathbyentity.EntityDeathByEntityEvent;
|
import com.willfp.eco.util.events.entitydeathbyentity.EntityDeathByEntityEvent;
|
||||||
import com.willfp.illusioner.illusioner.IllusionerManager;
|
import com.willfp.ecobosses.bosses.util.OptionedSound;
|
||||||
import com.willfp.illusioner.illusioner.OptionedSound;
|
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
package com.willfp.illusioner.illusioner.listeners;
|
package com.willfp.ecobosses.bosses.listeners;
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import com.willfp.illusioner.illusioner.BlockStructure;
|
import com.willfp.ecobosses.bosses.util.SpawnTotem;
|
||||||
import com.willfp.illusioner.illusioner.IllusionerManager;
|
import com.willfp.ecobosses.proxy.proxies.CustomIllusionerProxy;
|
||||||
import com.willfp.illusioner.proxy.proxies.EntityIllusionerProxy;
|
import com.willfp.ecobosses.util.ProxyUtils;
|
||||||
import com.willfp.illusioner.proxy.proxies.IllusionerHelperProxy;
|
|
||||||
import com.willfp.illusioner.util.ProxyUtils;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Illusioner;
|
import org.bukkit.entity.Illusioner;
|
||||||
@@ -56,7 +54,7 @@ public class SpawnListeners extends PluginDependent implements Listener {
|
|||||||
block3 = event.getBlock().getRelative(0, 1, 0);
|
block3 = event.getBlock().getRelative(0, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
matches = BlockStructure.matches(new BlockStructure(block1.getType(), block2.getType(), block3.getType()));
|
matches = SpawnTotem.matches(new SpawnTotem(block1.getType(), block2.getType(), block3.getType()));
|
||||||
if (matches) {
|
if (matches) {
|
||||||
match.add(block1);
|
match.add(block1);
|
||||||
match.add(block2);
|
match.add(block2);
|
||||||
@@ -78,7 +76,7 @@ public class SpawnListeners extends PluginDependent implements Listener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
EntityIllusionerProxy illusioner = ProxyUtils.getProxy(IllusionerHelperProxy.class).spawn(event.getBlock().getLocation());
|
CustomIllusionerProxy illusioner = ProxyUtils.getProxy(IllusionerHelperProxy.class).spawn(event.getBlock().getLocation());
|
||||||
illusioner.createBossbar(this.getPlugin());
|
illusioner.createBossbar(this.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +97,7 @@ public class SpawnListeners extends PluginDependent implements Listener {
|
|||||||
|
|
||||||
Illusioner illusioner = (Illusioner) event.getEntity();
|
Illusioner illusioner = (Illusioner) event.getEntity();
|
||||||
|
|
||||||
EntityIllusionerProxy internalIllusioner = ProxyUtils.getProxy(IllusionerHelperProxy.class).adapt(illusioner);
|
CustomIllusionerProxy internalIllusioner = ProxyUtils.getProxy(IllusionerHelperProxy.class).adapt(illusioner);
|
||||||
|
|
||||||
if (internalIllusioner == null) {
|
if (internalIllusioner == null) {
|
||||||
return;
|
return;
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
package com.willfp.ecobosses.bosses.options;
|
||||||
|
|
||||||
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
|
import com.willfp.ecobosses.bosses.util.EffectOption;
|
||||||
|
import com.willfp.ecobosses.bosses.util.OptionedSound;
|
||||||
|
import com.willfp.ecobosses.config.EcoBossesConfigs;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ToString
|
||||||
|
public class GameplayOptions extends PluginDependent {
|
||||||
|
/**
|
||||||
|
* The sound played when the illusioner takes damage.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private OptionedSound hitSound;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sound played when the illusioner spawns.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private OptionedSound summonSound;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The potion effect options.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final Set<EffectOption> effectOptions = new HashSet<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The mob summon options.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final Set<SummonerOption> summonerOptions = new HashSet<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the illusioner should shuffle hotbars.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private boolean shuffle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The chance of the illusioner shuffling a hotbar.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private double shuffleChance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the illusioner is immune to explosion damage.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private boolean ignoreExplosionDamage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the illusioner is immune to fire damage.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private boolean ignoreFire;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the illusioner is immune to suffocation damage.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private boolean ignoreSuffocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the illusioner can teleport.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private boolean teleport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Teleport range.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private int teleportRange;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Teleport chance.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private double teleportChance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Teleport sound.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private OptionedSound teleportSound;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gameplay options.
|
||||||
|
*
|
||||||
|
* @param plugin The plugin.
|
||||||
|
*/
|
||||||
|
public GameplayOptions(@NotNull final AbstractEcoPlugin plugin) {
|
||||||
|
super(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload the options.
|
||||||
|
*/
|
||||||
|
public void reload() {
|
||||||
|
hitSound = new OptionedSound(
|
||||||
|
Sound.valueOf(EcoBossesConfigs.SOUNDS.getString("hit.sound")),
|
||||||
|
(float) EcoBossesConfigs.SOUNDS.getDouble("hit.volume"),
|
||||||
|
(float) EcoBossesConfigs.SOUNDS.getDouble("hit.pitch"),
|
||||||
|
EcoBossesConfigs.SOUNDS.getBool("hit.broadcast")
|
||||||
|
);
|
||||||
|
|
||||||
|
summonSound = new OptionedSound(
|
||||||
|
Sound.valueOf(EcoBossesConfigs.SOUNDS.getString("summon.sound")),
|
||||||
|
(float) EcoBossesConfigs.SOUNDS.getDouble("summon.volume"),
|
||||||
|
(float) EcoBossesConfigs.SOUNDS.getDouble("summon.pitch"),
|
||||||
|
EcoBossesConfigs.SOUNDS.getBool("summon.broadcast")
|
||||||
|
);
|
||||||
|
|
||||||
|
shuffle = EcoBossesConfigs.ATTACKS.getBool("shuffle.enabled");
|
||||||
|
shuffleChance = EcoBossesConfigs.ATTACKS.getDouble("shuffle.chance");
|
||||||
|
|
||||||
|
ignoreExplosionDamage = this.getPlugin().getConfigYml().getBool("ignore-explosion-damage");
|
||||||
|
ignoreFire = this.getPlugin().getConfigYml().getBool("ignore-fire-damage");
|
||||||
|
ignoreSuffocation = this.getPlugin().getConfigYml().getBool("ignore-suffocation-damage");
|
||||||
|
|
||||||
|
teleport = this.getPlugin().getConfigYml().getBool("teleport-on-damage.enabled");
|
||||||
|
teleportRange = this.getPlugin().getConfigYml().getInt("teleport-on-damage.range");
|
||||||
|
teleportChance = this.getPlugin().getConfigYml().getDouble("teleport-on-damage.chance");
|
||||||
|
|
||||||
|
Sound sound = Sound.valueOf(EcoBossesConfigs.SOUNDS.getString("teleport.sound"));
|
||||||
|
float volume = (float) EcoBossesConfigs.SOUNDS.getDouble("teleport.volume");
|
||||||
|
float pitch = (float) EcoBossesConfigs.SOUNDS.getDouble("teleport.pitch");
|
||||||
|
teleportSound = new OptionedSound(sound, volume, pitch, true);
|
||||||
|
|
||||||
|
effectOptions.clear();
|
||||||
|
EcoBossesConfigs.ATTACKS.getConfig().getConfigurationSection("effects").getKeys(false).forEach(key -> {
|
||||||
|
PotionEffectType type = PotionEffectType.getByName(EcoBossesConfigs.ATTACKS.getString("effects." + key + ".type"));
|
||||||
|
int level = EcoBossesConfigs.ATTACKS.getInt("effects." + key + ".level");
|
||||||
|
int duration = EcoBossesConfigs.ATTACKS.getInt("effects." + key + ".duration");
|
||||||
|
double chance = EcoBossesConfigs.ATTACKS.getDouble("effects." + key + ".chance");
|
||||||
|
effectOptions.add(new EffectOption(chance, level, duration, type));
|
||||||
|
});
|
||||||
|
|
||||||
|
summonerOptions.clear();
|
||||||
|
EcoBossesConfigs.ATTACKS.getConfig().getConfigurationSection("summons").getKeys(false).forEach(key -> {
|
||||||
|
EntityType type = EntityType.valueOf(EcoBossesConfigs.ATTACKS.getString("summons." + key + ".type"));
|
||||||
|
double chance = EcoBossesConfigs.ATTACKS.getDouble("summons." + key + ".chance");
|
||||||
|
summonerOptions.add(new SummonerOption(chance, type));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.willfp.illusioner.illusioner.options;
|
package com.willfp.ecobosses.bosses.options;
|
||||||
|
|
||||||
import com.willfp.eco.util.NumberUtils;
|
import com.willfp.eco.util.NumberUtils;
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import com.willfp.eco.util.tuples.Pair;
|
import com.willfp.eco.util.tuples.Pair;
|
||||||
import com.willfp.illusioner.config.IllusionerConfigs;
|
import com.willfp.ecobosses.config.EcoBossesConfigs;
|
||||||
import com.willfp.illusioner.illusioner.BlockStructure;
|
import com.willfp.ecobosses.bosses.util.SpawnTotem;
|
||||||
import com.willfp.illusioner.illusioner.OptionedSound;
|
import com.willfp.ecobosses.bosses.util.OptionedSound;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -62,7 +62,7 @@ public class IllusionerOptions extends PluginDependent {
|
|||||||
* The spawn block structure.
|
* The spawn block structure.
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private BlockStructure spawnStructure;
|
private SpawnTotem spawnStructure;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The max health.
|
* The max health.
|
||||||
@@ -117,24 +117,24 @@ public class IllusionerOptions extends PluginDependent {
|
|||||||
override = this.getPlugin().getConfigYml().getBool("override");
|
override = this.getPlugin().getConfigYml().getBool("override");
|
||||||
|
|
||||||
spawnSounds = new HashSet<>();
|
spawnSounds = new HashSet<>();
|
||||||
IllusionerConfigs.SOUNDS.getConfig().getConfigurationSection("spawn").getKeys(false).forEach(key -> {
|
EcoBossesConfigs.SOUNDS.getConfig().getConfigurationSection("spawn").getKeys(false).forEach(key -> {
|
||||||
Sound sound = Sound.valueOf(IllusionerConfigs.SOUNDS.getString("spawn." + key + ".sound"));
|
Sound sound = Sound.valueOf(EcoBossesConfigs.SOUNDS.getString("spawn." + key + ".sound"));
|
||||||
boolean broadcast = IllusionerConfigs.SOUNDS.getBool("spawn." + key + ".broadcast");
|
boolean broadcast = EcoBossesConfigs.SOUNDS.getBool("spawn." + key + ".broadcast");
|
||||||
float volume = (float) IllusionerConfigs.SOUNDS.getDouble("spawn." + key + ".volume");
|
float volume = (float) EcoBossesConfigs.SOUNDS.getDouble("spawn." + key + ".volume");
|
||||||
float pitch = (float) IllusionerConfigs.SOUNDS.getDouble("spawn." + key + ".pitch");
|
float pitch = (float) EcoBossesConfigs.SOUNDS.getDouble("spawn." + key + ".pitch");
|
||||||
spawnSounds.add(new OptionedSound(sound, volume, pitch, broadcast));
|
spawnSounds.add(new OptionedSound(sound, volume, pitch, broadcast));
|
||||||
});
|
});
|
||||||
|
|
||||||
deathSounds = new HashSet<>();
|
deathSounds = new HashSet<>();
|
||||||
IllusionerConfigs.SOUNDS.getConfig().getConfigurationSection("death").getKeys(false).forEach(key -> {
|
EcoBossesConfigs.SOUNDS.getConfig().getConfigurationSection("death").getKeys(false).forEach(key -> {
|
||||||
Sound sound = Sound.valueOf(IllusionerConfigs.SOUNDS.getString("death." + key + ".sound"));
|
Sound sound = Sound.valueOf(EcoBossesConfigs.SOUNDS.getString("death." + key + ".sound"));
|
||||||
boolean broadcast = IllusionerConfigs.SOUNDS.getBool("death." + key + ".broadcast");
|
boolean broadcast = EcoBossesConfigs.SOUNDS.getBool("death." + key + ".broadcast");
|
||||||
float volume = (float) IllusionerConfigs.SOUNDS.getDouble("death." + key + ".volume");
|
float volume = (float) EcoBossesConfigs.SOUNDS.getDouble("death." + key + ".volume");
|
||||||
float pitch = (float) IllusionerConfigs.SOUNDS.getDouble("death." + key + ".pitch");
|
float pitch = (float) EcoBossesConfigs.SOUNDS.getDouble("death." + key + ".pitch");
|
||||||
deathSounds.add(new OptionedSound(sound, volume, pitch, broadcast));
|
deathSounds.add(new OptionedSound(sound, volume, pitch, broadcast));
|
||||||
});
|
});
|
||||||
|
|
||||||
spawnStructure = new BlockStructure(
|
spawnStructure = new SpawnTotem(
|
||||||
Material.valueOf(this.getPlugin().getConfigYml().getString("spawn.bottom-block")),
|
Material.valueOf(this.getPlugin().getConfigYml().getString("spawn.bottom-block")),
|
||||||
Material.valueOf(this.getPlugin().getConfigYml().getString("spawn.middle-block")),
|
Material.valueOf(this.getPlugin().getConfigYml().getString("spawn.middle-block")),
|
||||||
Material.valueOf(this.getPlugin().getConfigYml().getString("spawn.top-block"))
|
Material.valueOf(this.getPlugin().getConfigYml().getString("spawn.top-block"))
|
||||||
@@ -143,8 +143,8 @@ public class IllusionerOptions extends PluginDependent {
|
|||||||
gameplayOptions.reload();
|
gameplayOptions.reload();
|
||||||
|
|
||||||
drops = new ArrayList<>();
|
drops = new ArrayList<>();
|
||||||
for (String key : IllusionerConfigs.DROPS.getConfig().getKeys(false)) {
|
for (String key : EcoBossesConfigs.DROPS.getConfig().getKeys(false)) {
|
||||||
ItemStack itemStack = IllusionerConfigs.DROPS.getConfig().getItemStack(key);
|
ItemStack itemStack = EcoBossesConfigs.DROPS.getConfig().getItemStack(key);
|
||||||
if (itemStack == null || itemStack.getType() == Material.AIR) {
|
if (itemStack == null || itemStack.getType() == Material.AIR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.willfp.ecobosses.bosses.util;
|
||||||
|
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.boss.BarFlag;
|
||||||
|
import org.bukkit.boss.BossBar;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
@UtilityClass
|
||||||
|
public class BossbarUtils {
|
||||||
|
public BossBar createBossBar(@NotNull final LivingEntity entity) {
|
||||||
|
if (bossBar != null) {
|
||||||
|
return bossBar;
|
||||||
|
}
|
||||||
|
BossBar bossBar = Bukkit.getServer().createBossBar(this.displayName, IllusionerManager.OPTIONS.getColor(), IllusionerManager.OPTIONS.getStyle(), (BarFlag) null);
|
||||||
|
this.bossBar = bossBar;
|
||||||
|
|
||||||
|
LivingEntity entity = (LivingEntity) this.getBukkitEntity();
|
||||||
|
|
||||||
|
plugin.getRunnableFactory().create(runnable -> {
|
||||||
|
if (!entity.isDead()) {
|
||||||
|
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
||||||
|
entity.getNearbyEntities(50, 50, 50).forEach(entity1 -> {
|
||||||
|
if (entity1 instanceof Player) {
|
||||||
|
bossBar.addPlayer((Player) entity1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
runnable.cancel();
|
||||||
|
}
|
||||||
|
}).runTaskTimer(0, 40);
|
||||||
|
|
||||||
|
plugin.getRunnableFactory().create(runnable -> {
|
||||||
|
if (!entity.isDead()) {
|
||||||
|
bossBar.setProgress(entity.getHealth() / entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||||
|
} else {
|
||||||
|
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
||||||
|
bossBar.setVisible(false);
|
||||||
|
runnable.cancel();
|
||||||
|
}
|
||||||
|
}).runTaskTimer(0, 1);
|
||||||
|
|
||||||
|
return bossBar;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.willfp.ecobosses.bosses.util;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class EffectOption {
|
||||||
|
/**
|
||||||
|
* The chance of the effect being applied.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final double chance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The level of the effect.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final int level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The potion effect type.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final PotionEffectType effectType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The duration, in ticks.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final int duration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new effect option.
|
||||||
|
*
|
||||||
|
* @param chance The chance.
|
||||||
|
* @param level The level.
|
||||||
|
* @param duration The duration in ticks.
|
||||||
|
* @param effectType The effect.
|
||||||
|
*/
|
||||||
|
public EffectOption(final double chance,
|
||||||
|
final int level,
|
||||||
|
final int duration,
|
||||||
|
@NotNull final PotionEffectType effectType) {
|
||||||
|
this.chance = chance;
|
||||||
|
this.level = level;
|
||||||
|
this.effectType = effectType;
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.willfp.illusioner.illusioner;
|
package com.willfp.ecobosses.bosses.util;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@@ -23,27 +23,18 @@ public class OptionedSound {
|
|||||||
@Getter
|
@Getter
|
||||||
private final float pitch;
|
private final float pitch;
|
||||||
|
|
||||||
/**
|
|
||||||
* If the sound should be played to the whole server.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final boolean broadcast;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new optioned sound.
|
* Create a new optioned sound.
|
||||||
*
|
*
|
||||||
* @param sound The sound.
|
* @param sound The sound.
|
||||||
* @param volume The volume.
|
* @param volume The volume.
|
||||||
* @param pitch The pitch, from 0.5 to 2.
|
* @param pitch The pitch, from 0.5 to 2.
|
||||||
* @param broadcast If the sound should be played to the whole server.
|
|
||||||
*/
|
*/
|
||||||
public OptionedSound(@NotNull final Sound sound,
|
public OptionedSound(@NotNull final Sound sound,
|
||||||
final float volume,
|
final float volume,
|
||||||
final float pitch,
|
final float pitch) {
|
||||||
final boolean broadcast) {
|
|
||||||
this.sound = sound;
|
this.sound = sound;
|
||||||
this.volume = volume;
|
this.volume = volume;
|
||||||
this.pitch = pitch;
|
this.pitch = pitch;
|
||||||
this.broadcast = broadcast;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.willfp.ecobosses.bosses.util;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class SpawnTotem {
|
||||||
|
/**
|
||||||
|
* The bottom block.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final Material bottom;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The middle block.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final Material middle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The top block.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final Material top;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new spawn totem.
|
||||||
|
*
|
||||||
|
* @param bottom The bottom block.
|
||||||
|
* @param middle The middle block.
|
||||||
|
* @param top The top block.
|
||||||
|
*/
|
||||||
|
public SpawnTotem(@NotNull final Material bottom,
|
||||||
|
@NotNull final Material middle,
|
||||||
|
@NotNull final Material top) {
|
||||||
|
this.bottom = bottom;
|
||||||
|
this.middle = middle;
|
||||||
|
this.top = top;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(o instanceof SpawnTotem)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SpawnTotem that = (SpawnTotem) o;
|
||||||
|
return getBottom() == that.getBottom() && getMiddle() == that.getMiddle() && getTop() == that.getTop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(getBottom(), getMiddle(), getTop());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.willfp.ecobosses.bosses.util;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class SummonsOption {
|
||||||
|
/**
|
||||||
|
* The chance of a mob being spawned.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final double chance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of entity to summon.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final EntityType type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new summons option.
|
||||||
|
*
|
||||||
|
* @param chance The chance.
|
||||||
|
* @param type The entity type.
|
||||||
|
*/
|
||||||
|
public SummonsOption(final double chance,
|
||||||
|
@NotNull final EntityType type) {
|
||||||
|
this.chance = chance;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.willfp.ecobosses.commands;
|
||||||
|
|
||||||
|
import com.willfp.eco.util.command.AbstractCommand;
|
||||||
|
import com.willfp.ecobosses.EcoBossesPlugin;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CommandEbdrop extends AbstractCommand {
|
||||||
|
/**
|
||||||
|
* Instantiate a new executor for /ebdrop.
|
||||||
|
*
|
||||||
|
* @param plugin The plugin to manage the execution for.
|
||||||
|
*/
|
||||||
|
public CommandEbdrop(@NotNull final EcoBossesPlugin plugin) {
|
||||||
|
super(plugin, "ebdrop", "ecobosses.ebdrop", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onExecute(@NotNull final CommandSender sender,
|
||||||
|
@NotNull final List<String> args) {
|
||||||
|
Player player = (Player) sender;
|
||||||
|
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
|
player.sendMessage(this.getPlugin().getLangYml().getMessage("sent-drop"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,26 +1,27 @@
|
|||||||
package com.willfp.illusioner.commands;
|
package com.willfp.ecobosses.commands;
|
||||||
|
|
||||||
import com.willfp.eco.util.command.AbstractCommand;
|
import com.willfp.eco.util.command.AbstractCommand;
|
||||||
import com.willfp.illusioner.IllusionerPlugin;
|
import com.willfp.ecobosses.EcoBossesPlugin;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CommandIlreload extends AbstractCommand {
|
public class CommandEbreload extends AbstractCommand {
|
||||||
/**
|
/**
|
||||||
* Instantiate a new executor for /ilreload.
|
* Instantiate a new executor for /ebreload.
|
||||||
*
|
*
|
||||||
* @param plugin The plugin to manage the execution for.
|
* @param plugin The plugin to manage the execution for.
|
||||||
*/
|
*/
|
||||||
public CommandIlreload(@NotNull final IllusionerPlugin plugin) {
|
public CommandEbreload(@NotNull final EcoBossesPlugin plugin) {
|
||||||
super(plugin, "ilreload", "illusioner.reload", false);
|
super(plugin, "ebreload", "ecobosses.reload", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(@NotNull final CommandSender sender,
|
public void onExecute(@NotNull final CommandSender sender,
|
||||||
@NotNull final List<String> args) {
|
@NotNull final List<String> args) {
|
||||||
this.getPlugin().reload();
|
this.getPlugin().reload();
|
||||||
|
this.getPlugin().reload();
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("reloaded"));
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("reloaded"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.willfp.ecobosses.config;
|
||||||
|
|
||||||
|
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
|
|
||||||
|
@UtilityClass
|
||||||
|
public class EcoBossesConfigs {
|
||||||
|
/**
|
||||||
|
* Update all configs.
|
||||||
|
*/
|
||||||
|
@ConfigUpdater
|
||||||
|
public void updateConfigs() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.willfp.illusioner.util;
|
package com.willfp.ecobosses.util;
|
||||||
|
|
||||||
import com.willfp.eco.util.proxy.AbstractProxy;
|
import com.willfp.eco.util.proxy.AbstractProxy;
|
||||||
import com.willfp.illusioner.IllusionerPlugin;
|
import com.willfp.ecobosses.EcoBossesPlugin;
|
||||||
import com.willfp.illusioner.proxy.util.ProxyFactory;
|
import com.willfp.ecobosses.proxy.util.ProxyFactory;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -16,6 +16,6 @@ public class ProxyUtils {
|
|||||||
* @return The proxy implementation.
|
* @return The proxy implementation.
|
||||||
*/
|
*/
|
||||||
public @NotNull <T extends AbstractProxy> T getProxy(@NotNull final Class<T> proxyClass) {
|
public @NotNull <T extends AbstractProxy> T getProxy(@NotNull final Class<T> proxyClass) {
|
||||||
return new ProxyFactory<>(IllusionerPlugin.getInstance(), proxyClass).getProxy();
|
return new ProxyFactory<>(EcoBossesPlugin.getInstance(), proxyClass).getProxy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package com.willfp.illusioner.commands;
|
|
||||||
|
|
||||||
import com.willfp.eco.util.NumberUtils;
|
|
||||||
import com.willfp.eco.util.command.AbstractCommand;
|
|
||||||
import com.willfp.illusioner.IllusionerPlugin;
|
|
||||||
import com.willfp.illusioner.config.IllusionerConfigs;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CommandIldrop extends AbstractCommand {
|
|
||||||
/**
|
|
||||||
* Instantiate a new executor for /ildrop.
|
|
||||||
*
|
|
||||||
* @param plugin The plugin to manage the execution for.
|
|
||||||
*/
|
|
||||||
public CommandIldrop(@NotNull final IllusionerPlugin plugin) {
|
|
||||||
super(plugin, "ildrop", "illusioner.drop", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onExecute(@NotNull final CommandSender sender,
|
|
||||||
@NotNull final List<String> args) {
|
|
||||||
Player player = (Player) sender;
|
|
||||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
|
||||||
if (itemStack.getType() == Material.AIR) {
|
|
||||||
player.sendMessage(this.getPlugin().getLangYml().getMessage("no-item-held"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IllusionerConfigs.DROPS.getConfig().set(String.valueOf(NumberUtils.randInt(0, 100000)), itemStack);
|
|
||||||
IllusionerConfigs.DROPS.save();
|
|
||||||
IllusionerConfigs.DROPS.clearCache();
|
|
||||||
player.sendMessage(this.getPlugin().getLangYml().getMessage("added-drop"));
|
|
||||||
|
|
||||||
this.getPlugin().reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.willfp.illusioner.config;
|
|
||||||
|
|
||||||
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
|
|
||||||
import com.willfp.illusioner.config.configs.Attacks;
|
|
||||||
import com.willfp.illusioner.config.configs.Drops;
|
|
||||||
import com.willfp.illusioner.config.configs.Sounds;
|
|
||||||
import lombok.experimental.UtilityClass;
|
|
||||||
|
|
||||||
@UtilityClass
|
|
||||||
public class IllusionerConfigs {
|
|
||||||
/**
|
|
||||||
* drops.yml.
|
|
||||||
*/
|
|
||||||
public static final Drops DROPS = new Drops();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* sounds.yml.
|
|
||||||
*/
|
|
||||||
public static final Sounds SOUNDS = new Sounds();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* attacks.yml.
|
|
||||||
*/
|
|
||||||
public static final Attacks ATTACKS = new Attacks();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update all configs.
|
|
||||||
*/
|
|
||||||
@ConfigUpdater
|
|
||||||
public void updateConfigs() {
|
|
||||||
DROPS.save();
|
|
||||||
SOUNDS.update();
|
|
||||||
ATTACKS.update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.willfp.illusioner.config.configs;
|
|
||||||
|
|
||||||
import com.willfp.eco.util.config.BaseConfig;
|
|
||||||
import com.willfp.illusioner.IllusionerPlugin;
|
|
||||||
|
|
||||||
public class Attacks extends BaseConfig {
|
|
||||||
/**
|
|
||||||
* Instantiate attacks.yml.
|
|
||||||
*/
|
|
||||||
public Attacks() {
|
|
||||||
super("attacks", false, IllusionerPlugin.getInstance(), "effects.", "summons.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package com.willfp.illusioner.config.configs;
|
|
||||||
|
|
||||||
import com.willfp.eco.util.config.BaseConfig;
|
|
||||||
import com.willfp.illusioner.IllusionerPlugin;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class Drops extends BaseConfig {
|
|
||||||
/**
|
|
||||||
* Instantiate drops.yml.
|
|
||||||
*/
|
|
||||||
public Drops() {
|
|
||||||
super("drops", false, IllusionerPlugin.getInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Save config to drops.yml.
|
|
||||||
*/
|
|
||||||
public void save() {
|
|
||||||
try {
|
|
||||||
this.getConfig().save(this.getConfigFile());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.willfp.illusioner.config.configs;
|
|
||||||
|
|
||||||
import com.willfp.eco.util.config.BaseConfig;
|
|
||||||
import com.willfp.illusioner.IllusionerPlugin;
|
|
||||||
|
|
||||||
public class Sounds extends BaseConfig {
|
|
||||||
/**
|
|
||||||
* Instantiate sounds.yml.
|
|
||||||
*/
|
|
||||||
public Sounds() {
|
|
||||||
super("sounds", false, IllusionerPlugin.getInstance());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
package com.willfp.illusioner.illusioner;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public class BlockStructure {
|
|
||||||
/**
|
|
||||||
* The bottom block.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final Material bottom;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The middle block.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final Material middle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The top block.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final Material top;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new block structure.
|
|
||||||
*
|
|
||||||
* @param bottom The bottom block.
|
|
||||||
* @param middle The middle block.
|
|
||||||
* @param top The top block.
|
|
||||||
*/
|
|
||||||
public BlockStructure(@NotNull final Material bottom,
|
|
||||||
@NotNull final Material middle,
|
|
||||||
@NotNull final Material top) {
|
|
||||||
this.bottom = bottom;
|
|
||||||
this.middle = middle;
|
|
||||||
this.top = top;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If a block structure matches the specified structure in illusioner options.
|
|
||||||
*
|
|
||||||
* @param structure The block structure to test against.
|
|
||||||
* @return If the structures match.
|
|
||||||
*/
|
|
||||||
public static boolean matches(@NotNull final BlockStructure structure) {
|
|
||||||
return structure.getBottom().equals(IllusionerManager.OPTIONS.getSpawnStructure().getBottom())
|
|
||||||
&& structure.getMiddle().equals(IllusionerManager.OPTIONS.getSpawnStructure().getMiddle())
|
|
||||||
&& structure.getTop().equals(IllusionerManager.OPTIONS.getSpawnStructure().getTop());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.willfp.illusioner.illusioner;
|
|
||||||
|
|
||||||
import com.willfp.illusioner.IllusionerPlugin;
|
|
||||||
import com.willfp.illusioner.illusioner.options.IllusionerOptions;
|
|
||||||
|
|
||||||
public class IllusionerManager {
|
|
||||||
/**
|
|
||||||
* The options related to the illusioner.
|
|
||||||
*/
|
|
||||||
public static final IllusionerOptions OPTIONS = new IllusionerOptions(IllusionerPlugin.getInstance());
|
|
||||||
}
|
|
||||||
@@ -1,226 +0,0 @@
|
|||||||
package com.willfp.illusioner.illusioner.options;
|
|
||||||
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
|
||||||
import com.willfp.illusioner.config.IllusionerConfigs;
|
|
||||||
import com.willfp.illusioner.illusioner.OptionedSound;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.ToString;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@ToString
|
|
||||||
public class GameplayOptions extends PluginDependent {
|
|
||||||
/**
|
|
||||||
* The sound played when the illusioner takes damage.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private OptionedSound hitSound;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The sound played when the illusioner spawns.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private OptionedSound summonSound;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The potion effect options.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final Set<EffectOption> effectOptions = new HashSet<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The mob summon options.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final Set<SummonerOption> summonerOptions = new HashSet<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the illusioner should shuffle hotbars.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private boolean shuffle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The chance of the illusioner shuffling a hotbar.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private double shuffleChance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the illusioner is immune to explosion damage.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private boolean ignoreExplosionDamage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the illusioner is immune to fire damage.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private boolean ignoreFire;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the illusioner is immune to suffocation damage.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private boolean ignoreSuffocation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the illusioner can teleport.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private boolean teleport;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Teleport range.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private int teleportRange;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Teleport chance.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private double teleportChance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Teleport sound.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private OptionedSound teleportSound;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gameplay options.
|
|
||||||
*
|
|
||||||
* @param plugin The plugin.
|
|
||||||
*/
|
|
||||||
public GameplayOptions(@NotNull final AbstractEcoPlugin plugin) {
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reload the options.
|
|
||||||
*/
|
|
||||||
public void reload() {
|
|
||||||
hitSound = new OptionedSound(
|
|
||||||
Sound.valueOf(IllusionerConfigs.SOUNDS.getString("hit.sound")),
|
|
||||||
(float) IllusionerConfigs.SOUNDS.getDouble("hit.volume"),
|
|
||||||
(float) IllusionerConfigs.SOUNDS.getDouble("hit.pitch"),
|
|
||||||
IllusionerConfigs.SOUNDS.getBool("hit.broadcast")
|
|
||||||
);
|
|
||||||
|
|
||||||
summonSound = new OptionedSound(
|
|
||||||
Sound.valueOf(IllusionerConfigs.SOUNDS.getString("summon.sound")),
|
|
||||||
(float) IllusionerConfigs.SOUNDS.getDouble("summon.volume"),
|
|
||||||
(float) IllusionerConfigs.SOUNDS.getDouble("summon.pitch"),
|
|
||||||
IllusionerConfigs.SOUNDS.getBool("summon.broadcast")
|
|
||||||
);
|
|
||||||
|
|
||||||
shuffle = IllusionerConfigs.ATTACKS.getBool("shuffle.enabled");
|
|
||||||
shuffleChance = IllusionerConfigs.ATTACKS.getDouble("shuffle.chance");
|
|
||||||
|
|
||||||
ignoreExplosionDamage = this.getPlugin().getConfigYml().getBool("ignore-explosion-damage");
|
|
||||||
ignoreFire = this.getPlugin().getConfigYml().getBool("ignore-fire-damage");
|
|
||||||
ignoreSuffocation = this.getPlugin().getConfigYml().getBool("ignore-suffocation-damage");
|
|
||||||
|
|
||||||
teleport = this.getPlugin().getConfigYml().getBool("teleport-on-damage.enabled");
|
|
||||||
teleportRange = this.getPlugin().getConfigYml().getInt("teleport-on-damage.range");
|
|
||||||
teleportChance = this.getPlugin().getConfigYml().getDouble("teleport-on-damage.chance");
|
|
||||||
|
|
||||||
Sound sound = Sound.valueOf(IllusionerConfigs.SOUNDS.getString("teleport.sound"));
|
|
||||||
float volume = (float) IllusionerConfigs.SOUNDS.getDouble("teleport.volume");
|
|
||||||
float pitch = (float) IllusionerConfigs.SOUNDS.getDouble("teleport.pitch");
|
|
||||||
teleportSound = new OptionedSound(sound, volume, pitch, true);
|
|
||||||
|
|
||||||
effectOptions.clear();
|
|
||||||
IllusionerConfigs.ATTACKS.getConfig().getConfigurationSection("effects").getKeys(false).forEach(key -> {
|
|
||||||
PotionEffectType type = PotionEffectType.getByName(IllusionerConfigs.ATTACKS.getString("effects." + key + ".type"));
|
|
||||||
int level = IllusionerConfigs.ATTACKS.getInt("effects." + key + ".level");
|
|
||||||
int duration = IllusionerConfigs.ATTACKS.getInt("effects." + key + ".duration");
|
|
||||||
double chance = IllusionerConfigs.ATTACKS.getDouble("effects." + key + ".chance");
|
|
||||||
effectOptions.add(new EffectOption(chance, level, duration, type));
|
|
||||||
});
|
|
||||||
|
|
||||||
summonerOptions.clear();
|
|
||||||
IllusionerConfigs.ATTACKS.getConfig().getConfigurationSection("summons").getKeys(false).forEach(key -> {
|
|
||||||
EntityType type = EntityType.valueOf(IllusionerConfigs.ATTACKS.getString("summons." + key + ".type"));
|
|
||||||
double chance = IllusionerConfigs.ATTACKS.getDouble("summons." + key + ".chance");
|
|
||||||
summonerOptions.add(new SummonerOption(chance, type));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class EffectOption {
|
|
||||||
/**
|
|
||||||
* The chance of the effect being applied.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final double chance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The level of the effect.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final int level;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The potion effect type.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final PotionEffectType effectType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The duration, in ticks.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final int duration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new effect option.
|
|
||||||
*
|
|
||||||
* @param chance The chance.
|
|
||||||
* @param level The level.
|
|
||||||
* @param duration The duration in ticks.
|
|
||||||
* @param effectType The effect.
|
|
||||||
*/
|
|
||||||
public EffectOption(final double chance,
|
|
||||||
final int level,
|
|
||||||
final int duration,
|
|
||||||
@NotNull final PotionEffectType effectType) {
|
|
||||||
this.chance = chance;
|
|
||||||
this.level = level;
|
|
||||||
this.effectType = effectType;
|
|
||||||
this.duration = duration;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SummonerOption {
|
|
||||||
/**
|
|
||||||
* The chance of a mob being spawned.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final double chance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The type of entity to summon.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
private final EntityType type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new summoner option.
|
|
||||||
*
|
|
||||||
* @param chance The chance.
|
|
||||||
* @param type The entity type.
|
|
||||||
*/
|
|
||||||
public SummonerOption(final double chance,
|
|
||||||
@NotNull final EntityType type) {
|
|
||||||
this.chance = chance;
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
# All chances are percentages and can include decimals
|
|
||||||
|
|
||||||
shuffle: # Shuffles the items around in your hotbar
|
|
||||||
enabled: true
|
|
||||||
chance: 5
|
|
||||||
|
|
||||||
effects:
|
|
||||||
# Types can be found here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionEffectType.html
|
|
||||||
# Duration is in ticks, there are 20 ticks in a second
|
|
||||||
1:
|
|
||||||
type: BLINDNESS
|
|
||||||
level: 1
|
|
||||||
duration: 40
|
|
||||||
chance: 20
|
|
||||||
2:
|
|
||||||
type: CONFUSION
|
|
||||||
level: 10
|
|
||||||
duration: 200
|
|
||||||
chance: 10
|
|
||||||
3:
|
|
||||||
type: SLOW
|
|
||||||
level: 3
|
|
||||||
duration: 60
|
|
||||||
chance: 10
|
|
||||||
|
|
||||||
summons:
|
|
||||||
# Entity Types can be found here: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/EntityType.html
|
|
||||||
# Entities are summoned close to the player
|
|
||||||
1:
|
|
||||||
type: VINDICATOR
|
|
||||||
chance: 10
|
|
||||||
2:
|
|
||||||
type: EVOKER
|
|
||||||
chance: 10
|
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
enabled: true
|
||||||
|
|
||||||
|
name: "Illusioner" # Display name
|
||||||
|
base-mob: custom_illusioner # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin)
|
||||||
|
|
||||||
|
spawn-egg:
|
||||||
|
mob-type: illusioner
|
||||||
|
display-name: "Illusioner Spawn Egg"
|
||||||
|
lore: []
|
||||||
|
|
||||||
|
bossbar:
|
||||||
|
enabled: true
|
||||||
|
color: BLUE # Choose from: BLUE, GREEN, PINK, PURPLE, RED, WHITE, YELLOW
|
||||||
|
style: SOLID # Choose from: SOLID, SEGMENTED_6, SEGMENTED_10, SEGMENTED_12, SEGMENTED_20
|
||||||
|
|
||||||
|
max-health: 600
|
||||||
|
attack-damage: 50
|
||||||
|
|
||||||
|
spawn-totem:
|
||||||
|
enabled: true
|
||||||
|
top: carved_pumpkin
|
||||||
|
middle: beacon
|
||||||
|
bottom: diamond
|
||||||
|
|
||||||
|
rewards:
|
||||||
|
xp:
|
||||||
|
minimum: 20000
|
||||||
|
maximum: 25000
|
||||||
|
drops:
|
||||||
|
# Get items to add here by copying the console output for /ebdrop
|
||||||
|
|
||||||
|
defence:
|
||||||
|
immunities:
|
||||||
|
explosion: true
|
||||||
|
fire: false
|
||||||
|
drowning: true
|
||||||
|
projectiles: false
|
||||||
|
suffocation: true
|
||||||
|
|
||||||
|
# If the boss should teleport when damaged
|
||||||
|
teleport:
|
||||||
|
enabled: false
|
||||||
|
range: 7
|
||||||
|
chance: 15 # As a percentage
|
||||||
|
|
||||||
|
attacks:
|
||||||
|
# Potion effects are formatted like this:
|
||||||
|
# effect:level:duration:chance
|
||||||
|
# Duration is in ticks, chance is as a percentage
|
||||||
|
potion-effects:
|
||||||
|
- "confusion:10:200:10"
|
||||||
|
- "blindness:1:40:20"
|
||||||
|
|
||||||
|
# Bonus enemies that spawn to fight you
|
||||||
|
# entity:chance
|
||||||
|
# Chance is as a percentage
|
||||||
|
summons:
|
||||||
|
- "evoker:10"
|
||||||
|
- "vindicator:10"
|
||||||
|
|
||||||
|
# Chance to shuffle your hotbar as a percentage - set to 0 to disable.
|
||||||
|
shuffle-chance: 10
|
||||||
|
|
||||||
|
sounds:
|
||||||
|
# Sounds are formatted like this:
|
||||||
|
# sound:volume:pitch
|
||||||
|
|
||||||
|
# Sound is the sound ID
|
||||||
|
# Volume is the distance that it can be heard from
|
||||||
|
# Pitch is 0.5-2
|
||||||
|
|
||||||
|
spawn: # On spawn
|
||||||
|
- "entity_illusioner_mirror_move:1000:0.5"
|
||||||
|
- "entity_wither_spawn:1000L:2"
|
||||||
|
|
||||||
|
death: # On death
|
||||||
|
- "entity_evoker_prepare_wololo:50:0.8"
|
||||||
|
- "entity_illusioner_prepare_blindness:50:1"
|
||||||
|
- "entity_wither_death:50:2"
|
||||||
|
|
||||||
|
summon: # On summon enemy
|
||||||
|
- "entity_evoker_prepare_attack:1:2"
|
||||||
|
|
||||||
|
injure: # On take damage
|
||||||
|
- "entity_illusioner_cast_spell:1:2"
|
||||||
@@ -1,36 +1,4 @@
|
|||||||
#
|
#
|
||||||
# Illusioner
|
# EcoBosses
|
||||||
# by Auxilor
|
# by Auxilor
|
||||||
#
|
#
|
||||||
|
|
||||||
name: "Illusioner" # What should the display name of the Illusioner be?
|
|
||||||
|
|
||||||
override: true # Should the illusioner override all "vanilla" illusioners (adds support for /spawn but may cause issues with other custom mob plugins)
|
|
||||||
|
|
||||||
bossbar:
|
|
||||||
color: BLUE # Choose from: BLUE, GREEN, PINK, PURPLE, RED, WHITE, YELLOW
|
|
||||||
style: SOLID # Choose from: SOLID, SEGMENTED_6, SEGMENTED_10, SEGMENTED_12, SEGMENTED_20
|
|
||||||
|
|
||||||
xp:
|
|
||||||
# Chosen at random between a minimum and maximum
|
|
||||||
minimum: 20000 # Xp points, not levels
|
|
||||||
maximum: 25000
|
|
||||||
|
|
||||||
max-health: 600 # Hearts is this number divided by 2, eg 600 is 300 hearts
|
|
||||||
attack-damage: 50 # This isn't an easy boss. Recommend to keep this high
|
|
||||||
|
|
||||||
ignore-explosion-damage: true
|
|
||||||
ignore-fire-damage: false
|
|
||||||
ignore-suffocation-damage: true
|
|
||||||
|
|
||||||
teleport-on-damage:
|
|
||||||
enabled: true
|
|
||||||
range: 7
|
|
||||||
chance: 15 # As a percentage
|
|
||||||
|
|
||||||
spawn:
|
|
||||||
# Configure a 3x1 tall column of blocks to summon an illusioner
|
|
||||||
# Plan to add support for other shapes in the future
|
|
||||||
top-block: CARVED_PUMPKIN
|
|
||||||
middle-block: BEACON
|
|
||||||
bottom-block: DIAMOND_BLOCK
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Add drops with /ildrop
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
messages:
|
messages:
|
||||||
prefix: "&9&lIllusioner &f» "
|
prefix: "&9&lEcoBosses &f» "
|
||||||
no-permission: "&cYou don't have permission to do this!"
|
no-permission: "&cYou don't have permission to do this!"
|
||||||
not-player: "&cThis command must be run by a player"
|
not-player: "&cThis command must be run by a player"
|
||||||
reloaded: "Reloaded!"
|
reloaded: "Reloaded!"
|
||||||
no-item-held: "&cYou aren't holding an item!"
|
sent-drop: "Check console for the drop!"
|
||||||
added-drop: "Added drop to Illusioner"
|
|
||||||
reload-plugin: "Run /ilreload to reload illusioner!"
|
|
||||||
@@ -1,30 +1,31 @@
|
|||||||
name: Illusioner
|
name: EcoBosses
|
||||||
version: ${projectVersion}
|
version: ${projectVersion}
|
||||||
main: com.willfp.illusioner.IllusionerPlugin
|
main: com.willfp.ecobosses.EcoBossesPlugin
|
||||||
api-version: 1.15
|
api-version: 1.15
|
||||||
authors: [Auxilor]
|
authors: [Auxilor]
|
||||||
website: willfp.com
|
website: willfp.com
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
ilreload:
|
ebreload:
|
||||||
description: Reloads config
|
description: Reloads config
|
||||||
permission: illusioner.reload
|
permission: ecobosses.reload
|
||||||
ildrop:
|
ebdrop:
|
||||||
description: Adds the item in your hand as a drop
|
description: Sends the held item to console to be added as a drop
|
||||||
permission: illusioner.drop
|
permission: ecobosses.ebdrop
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
illusioner.*:
|
ecobosses.*:
|
||||||
description: All illusioner permissions
|
description: All ecobosses permissions
|
||||||
default: op
|
default: op
|
||||||
children:
|
children:
|
||||||
illusioner.reload: true
|
ecobosses.reload: true
|
||||||
illusioner.updateannounce: true
|
ecobosses.ebdrop: true
|
||||||
|
|
||||||
illusioner.updateannounce:
|
ecobosses.reload:
|
||||||
description: Informs admins of a new update
|
|
||||||
default: op
|
|
||||||
illusioner.reload:
|
|
||||||
description: Allows reloading the config
|
description: Allows reloading the config
|
||||||
default: op
|
default: op
|
||||||
|
|
||||||
|
ecobosses.ebdrop:
|
||||||
|
description: Allows the use of /ebdrop
|
||||||
|
default: op
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
# A sound is defined as follows:
|
|
||||||
# broadcast - Should the whole server hear this or just the player?
|
|
||||||
# volume - How far away should people be able to hear this?
|
|
||||||
# pitch - Range is 0.5 to 2, 0.5 is lower pitch and half speed, 2 is higher pitch and double speed
|
|
||||||
# Add as many sounds as you want
|
|
||||||
|
|
||||||
hit:
|
|
||||||
# When the player attacks the illusioner
|
|
||||||
broadcast: false
|
|
||||||
sound: ENTITY_ILLUSIONER_CAST_SPELL
|
|
||||||
volume: 1
|
|
||||||
pitch: 2
|
|
||||||
|
|
||||||
summon:
|
|
||||||
# When an entity is summoned by the illusioner
|
|
||||||
broadcast: false
|
|
||||||
sound: ENTITY_EVOKER_PREPARE_ATTACK
|
|
||||||
volume: 1
|
|
||||||
pitch: 2
|
|
||||||
|
|
||||||
teleport:
|
|
||||||
# When the illusioner teleports
|
|
||||||
sound: ENTITY_ENDERMAN_TELEPORT
|
|
||||||
volume: 1
|
|
||||||
pitch: 0.7
|
|
||||||
|
|
||||||
spawn:
|
|
||||||
1:
|
|
||||||
broadcast: true
|
|
||||||
sound: ENTITY_ILLUSIONER_MIRROR_MOVE
|
|
||||||
volume: 1000
|
|
||||||
pitch: 0.5
|
|
||||||
2:
|
|
||||||
broadcast: true
|
|
||||||
sound: ENTITY_WITHER_SPAWN
|
|
||||||
volume: 1000
|
|
||||||
pitch: 2
|
|
||||||
death:
|
|
||||||
1:
|
|
||||||
broadcast: true
|
|
||||||
sound: ENTITY_EVOKER_PREPARE_WOLOLO
|
|
||||||
volume: 50
|
|
||||||
pitch: 0.8
|
|
||||||
2:
|
|
||||||
broadcast: true
|
|
||||||
sound: ENTITY_ILLUSIONER_PREPARE_BLINDNESS
|
|
||||||
volume: 50
|
|
||||||
pitch: 1
|
|
||||||
3:
|
|
||||||
broadcast: true
|
|
||||||
sound: ENTITY_WITHER_DEATH
|
|
||||||
volume: 50
|
|
||||||
pitch: 2
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.willfp.ecobosses.proxy.proxies;
|
||||||
|
|
||||||
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
|
import com.willfp.eco.util.proxy.AbstractProxy;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.boss.BossBar;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public interface CustomIllusionerProxy extends AbstractProxy {
|
||||||
|
/**
|
||||||
|
* Spawn an illusioner.
|
||||||
|
*
|
||||||
|
* @param location The location to spawn it at.
|
||||||
|
* @return The created illusioner.
|
||||||
|
*/
|
||||||
|
CustomIllusionerProxy spawn(@NotNull Location location);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.willfp.illusioner.proxy.util;
|
package com.willfp.ecobosses.proxy.util;
|
||||||
|
|
||||||
import com.willfp.eco.util.internal.PluginDependent;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.willfp.illusioner.proxy.proxies;
|
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
|
||||||
import com.willfp.eco.util.proxy.AbstractProxy;
|
|
||||||
import org.bukkit.boss.BossBar;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public interface EntityIllusionerProxy extends AbstractProxy {
|
|
||||||
/**
|
|
||||||
* Create boss bar for an illusioner.
|
|
||||||
*
|
|
||||||
* @param plugin The plugin that owns the boss bar.
|
|
||||||
* @return The created boss bar.
|
|
||||||
*/
|
|
||||||
BossBar createBossbar(@NotNull AbstractEcoPlugin plugin);
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.willfp.illusioner.proxy.proxies;
|
|
||||||
|
|
||||||
import com.willfp.eco.util.proxy.AbstractProxy;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Illusioner;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public interface IllusionerHelperProxy extends AbstractProxy {
|
|
||||||
/**
|
|
||||||
* Spawn an illusioner.
|
|
||||||
*
|
|
||||||
* @param location The location to spawn it at.
|
|
||||||
* @return The created illusioner.
|
|
||||||
*/
|
|
||||||
EntityIllusionerProxy spawn(@NotNull Location location);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a normal illusioner to a plugin-based one.
|
|
||||||
*
|
|
||||||
* @param illusioner The illusioner to convert.
|
|
||||||
* @return The created illusioner.
|
|
||||||
*/
|
|
||||||
EntityIllusionerProxy adapt(@NotNull Illusioner illusioner);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user