9
0
mirror of https://github.com/Auxilor/EcoMobs.git synced 2025-12-23 00:49:36 +00:00

Added 'baby: true/false' option for boss config to control the mob age.

This commit is contained in:
_OfTeN_
2021-09-20 11:16:44 +03:00
parent 203bec560e
commit 468b0b4292
6 changed files with 16 additions and 0 deletions

View File

@@ -124,6 +124,11 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
@Getter
private final int attackDamage;
/**
* Age state.
*/
@Getter
private final boolean baby;
/**
* The follow range.
@@ -325,6 +330,7 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
this.name = name;
this.livingBosses = new HashMap<>();
this.isGlowing = this.getConfig().getBool("glowing");
this.baby = this.getConfig().getBool("baby");
this.displayName = this.getConfig().getString("name");

View File

@@ -21,6 +21,7 @@ import org.bukkit.attribute.AttributeInstance;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.block.Block;
import org.bukkit.boss.BarFlag;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.EntityEquipment;
@@ -107,6 +108,11 @@ public class LivingEcoBoss extends PluginDependent<EcoPlugin> {
if (boss.isGlowing()) entity.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, Integer.MAX_VALUE, 1, false, false, false));
if (entity instanceof Ageable ageable) {
if (boss.isBaby()) ageable.setBaby();
else ageable.setAdult();
}
if (boss.getTimeToLive() > 0) {
entity.setMetadata("death-time", this.getPlugin().getMetadataValueFactory().create(System.currentTimeMillis() + (boss.getTimeToLive() * 1000L)));
}

View File

@@ -2,6 +2,7 @@ enabled: true
name: "&fAlpha Wolf &7| &c%health%♥ &7| &e%time%" # Display name
base-mob: wolf
baby: false # If set to true: will make the boss mob baby (if possible)
bossbar:
enabled: true

View File

@@ -2,6 +2,7 @@ enabled: true
name: "&9Dark Guardian &7| &c%health%♥ &7| &e%time%" # Display name
base-mob: ravager
baby: false # If set to true: will make the boss mob baby (if possible)
bossbar:
enabled: true

View File

@@ -2,6 +2,7 @@ enabled: true
name: "&8Steel Golem &7| &c%health%♥ &7| &e%time%" # Display name
base-mob: iron_golem
baby: false # If set to true: will make the boss mob baby (if possible)
bossbar:
enabled: true

View File

@@ -2,6 +2,7 @@ enabled: true
name: "&4Tarantula &7| &c%health%♥ &7| &e%time%" # Display name
base-mob: cave_spider
baby: false # If set to true: will make the boss mob baby (if possible)
bossbar:
enabled: true