From d8c229d4fafa9de7d6594c045e3cc5b062ba09b3 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Fri, 17 Sep 2021 21:17:27 +0300 Subject: [PATCH] Added glowing: true/false option for boss config --- .../src/main/java/com/willfp/ecobosses/bosses/EcoBoss.java | 7 +++++++ .../java/com/willfp/ecobosses/bosses/LivingEcoBoss.java | 4 ++++ .../core-plugin/src/main/resources/bosses/alpha_wolf.yml | 1 + .../src/main/resources/bosses/dark_guardian.yml | 1 + .../core-plugin/src/main/resources/bosses/steel_golem.yml | 1 + .../core-plugin/src/main/resources/bosses/tarantula.yml | 1 + 6 files changed, 15 insertions(+) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/EcoBoss.java b/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/EcoBoss.java index 9ec6a42..722f3f0 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/EcoBoss.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/EcoBoss.java @@ -233,6 +233,12 @@ public class EcoBoss extends PluginDependent { @Getter private final Map incomingMultipliers; + /** + * Boss glowing effect. + */ + @Getter + private final boolean isGlowing; + /** * The currently living bosses of this type. */ @@ -313,6 +319,7 @@ public class EcoBoss extends PluginDependent { this.config = config; this.name = name; this.livingBosses = new HashMap<>(); + this.isGlowing = this.getConfig().getBool("glowing"); this.displayName = this.getConfig().getString("name"); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/LivingEcoBoss.java b/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/LivingEcoBoss.java index cff355d..d481371 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/LivingEcoBoss.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/LivingEcoBoss.java @@ -21,6 +21,8 @@ import org.bukkit.boss.BarFlag; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.persistence.PersistentDataType; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -98,6 +100,8 @@ public class LivingEcoBoss extends PluginDependent { entity.setPersistent(true); entity.setRemoveWhenFarAway(false); + if (boss.isGlowing()) entity.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, Integer.MAX_VALUE, 1, false, false, false)); + if (boss.getTimeToLive() > 0) { entity.setMetadata("death-time", this.getPlugin().getMetadataValueFactory().create(System.currentTimeMillis() + (boss.getTimeToLive() * 1000L))); } diff --git a/eco-core/core-plugin/src/main/resources/bosses/alpha_wolf.yml b/eco-core/core-plugin/src/main/resources/bosses/alpha_wolf.yml index 519da88..6c40a06 100644 --- a/eco-core/core-plugin/src/main/resources/bosses/alpha_wolf.yml +++ b/eco-core/core-plugin/src/main/resources/bosses/alpha_wolf.yml @@ -13,6 +13,7 @@ attack-damage: 50 movement-speed: 2 follow-range: 15 time-to-live: 120 # Time to live before auto despawn, in seconds. Set to -1 to disable. +glowing: false # Should this boss have glowing effect auto-spawn-interval: -1 # Time between auto spawns in ticks (20 ticks in a second) - Set to -1 to disable. auto-spawn-locations: [ ] # Formatted as world:x:y:z - for example world_nether:100:10:100 diff --git a/eco-core/core-plugin/src/main/resources/bosses/dark_guardian.yml b/eco-core/core-plugin/src/main/resources/bosses/dark_guardian.yml index 4fe016c..49a14ad 100644 --- a/eco-core/core-plugin/src/main/resources/bosses/dark_guardian.yml +++ b/eco-core/core-plugin/src/main/resources/bosses/dark_guardian.yml @@ -13,6 +13,7 @@ attack-damage: 30 movement-speed: 1.2 follow-range: 20 time-to-live: 120 # Time to live before auto despawn, in seconds. Set to -1 to disable. +glowing: false # Should this boss have glowing effect auto-spawn-interval: -1 # Time between auto spawns in ticks (20 ticks in a second) - Set to -1 to disable. auto-spawn-locations: [ ] # Formatted as world:x:y:z - for example world_nether:100:10:100 diff --git a/eco-core/core-plugin/src/main/resources/bosses/steel_golem.yml b/eco-core/core-plugin/src/main/resources/bosses/steel_golem.yml index 6da8b25..8eee847 100644 --- a/eco-core/core-plugin/src/main/resources/bosses/steel_golem.yml +++ b/eco-core/core-plugin/src/main/resources/bosses/steel_golem.yml @@ -13,6 +13,7 @@ attack-damage: 90 movement-speed: 1.5 follow-range: 16 time-to-live: 120 # Time to live before auto despawn, in seconds. Set to -1 to disable. +glowing: false # Should this boss have glowing effect auto-spawn-interval: -1 # Time between auto spawns in ticks (20 ticks in a second) - Set to -1 to disable. auto-spawn-locations: [] # Formatted as world:x:y:z - for example world_nether:100:10:100 diff --git a/eco-core/core-plugin/src/main/resources/bosses/tarantula.yml b/eco-core/core-plugin/src/main/resources/bosses/tarantula.yml index 59d3250..ae4c3d4 100644 --- a/eco-core/core-plugin/src/main/resources/bosses/tarantula.yml +++ b/eco-core/core-plugin/src/main/resources/bosses/tarantula.yml @@ -13,6 +13,7 @@ attack-damage: 70 movement-speed: 1.3 follow-range: 15 time-to-live: 120 # Time to live before auto despawn, in seconds. Set to -1 to disable. +glowing: false # Should this boss have glowing effect auto-spawn-interval: -1 # Time between auto spawns in ticks (20 ticks in a second) - Set to -1 to disable. auto-spawn-locations: [ ] # Formatted as world:x:y:z - for example world_nether:100:10:100