mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-23 17:09:27 +00:00
Added 'baby: true/false' option for boss config to control the mob age.
This commit is contained in:
@@ -124,6 +124,11 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
|
|||||||
@Getter
|
@Getter
|
||||||
private final int attackDamage;
|
private final int attackDamage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Age state.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final boolean baby;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The follow range.
|
* The follow range.
|
||||||
@@ -325,6 +330,7 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.livingBosses = new HashMap<>();
|
this.livingBosses = new HashMap<>();
|
||||||
this.isGlowing = this.getConfig().getBool("glowing");
|
this.isGlowing = this.getConfig().getBool("glowing");
|
||||||
|
this.baby = this.getConfig().getBool("baby");
|
||||||
|
|
||||||
this.displayName = this.getConfig().getString("name");
|
this.displayName = this.getConfig().getString("name");
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import org.bukkit.attribute.AttributeInstance;
|
|||||||
import org.bukkit.attribute.AttributeModifier;
|
import org.bukkit.attribute.AttributeModifier;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.boss.BarFlag;
|
import org.bukkit.boss.BarFlag;
|
||||||
|
import org.bukkit.entity.Ageable;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.EntityEquipment;
|
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 (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) {
|
if (boss.getTimeToLive() > 0) {
|
||||||
entity.setMetadata("death-time", this.getPlugin().getMetadataValueFactory().create(System.currentTimeMillis() + (boss.getTimeToLive() * 1000L)));
|
entity.setMetadata("death-time", this.getPlugin().getMetadataValueFactory().create(System.currentTimeMillis() + (boss.getTimeToLive() * 1000L)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ enabled: true
|
|||||||
|
|
||||||
name: "&fAlpha Wolf &7| &c%health%♥ &7| &e%time%" # Display name
|
name: "&fAlpha Wolf &7| &c%health%♥ &7| &e%time%" # Display name
|
||||||
base-mob: wolf
|
base-mob: wolf
|
||||||
|
baby: false # If set to true: will make the boss mob baby (if possible)
|
||||||
|
|
||||||
bossbar:
|
bossbar:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ enabled: true
|
|||||||
|
|
||||||
name: "&9Dark Guardian &7| &c%health%♥ &7| &e%time%" # Display name
|
name: "&9Dark Guardian &7| &c%health%♥ &7| &e%time%" # Display name
|
||||||
base-mob: ravager
|
base-mob: ravager
|
||||||
|
baby: false # If set to true: will make the boss mob baby (if possible)
|
||||||
|
|
||||||
bossbar:
|
bossbar:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ enabled: true
|
|||||||
|
|
||||||
name: "&8Steel Golem &7| &c%health%♥ &7| &e%time%" # Display name
|
name: "&8Steel Golem &7| &c%health%♥ &7| &e%time%" # Display name
|
||||||
base-mob: iron_golem
|
base-mob: iron_golem
|
||||||
|
baby: false # If set to true: will make the boss mob baby (if possible)
|
||||||
|
|
||||||
bossbar:
|
bossbar:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ enabled: true
|
|||||||
|
|
||||||
name: "&4Tarantula &7| &c%health%♥ &7| &e%time%" # Display name
|
name: "&4Tarantula &7| &c%health%♥ &7| &e%time%" # Display name
|
||||||
base-mob: cave_spider
|
base-mob: cave_spider
|
||||||
|
baby: false # If set to true: will make the boss mob baby (if possible)
|
||||||
|
|
||||||
bossbar:
|
bossbar:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
Reference in New Issue
Block a user