diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/EcoBossesPlugin.java b/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/EcoBossesPlugin.java index 5e491f6..b6405cc 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/EcoBossesPlugin.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/EcoBossesPlugin.java @@ -12,6 +12,7 @@ import com.willfp.ecobosses.bosses.listeners.SpawnListeners; import com.willfp.ecobosses.commands.CommandEbdrop; import com.willfp.ecobosses.commands.CommandEbreload; import com.willfp.ecobosses.commands.CommandEbspawn; +import com.willfp.ecobosses.commands.TabCompleterEbspawn; import lombok.Getter; import org.bukkit.event.Listener; import org.jetbrains.annotations.Nullable; @@ -127,7 +128,8 @@ public class EcoBossesPlugin extends AbstractEcoPlugin { @Override public List> getUpdatableClasses() { return Arrays.asList( - EcoBosses.class + EcoBosses.class, + TabCompleterEbspawn.class ); } 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 6ad7726..2f30435 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 @@ -27,6 +27,7 @@ import org.bukkit.boss.BarColor; import org.bukkit.boss.BarFlag; import org.bukkit.boss.BarStyle; import org.bukkit.boss.BossBar; +import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -228,9 +229,12 @@ public class EcoBoss extends PluginDependent { // Rewards this.drops = new ArrayList<>(); - this.getConfig().getSection("rewards.drops").getKeys(false).forEach(s -> { - this.drops.add(this.getConfig().getConfig().getItemStack("rewards.drops." + s)); - }); + ConfigurationSection dropsSection = this.getConfig().getSectionOrNull("rewards.drops"); + if (dropsSection != null) { + dropsSection.getKeys(false).forEach(s -> { + this.drops.add(this.getConfig().getConfig().getItemStack("rewards.drops." + s)); + }); + } this.experienceOptions = new ExperienceOptions( this.getConfig().getInt("rewards.xp.minimum"), this.getConfig().getInt("rewards.xp.maximum") @@ -317,7 +321,7 @@ public class EcoBoss extends PluginDependent { } // Spawn egg - Material eggMaterial = Material.matchMaterial("spawn-egg.egg-material"); + Material eggMaterial = Material.matchMaterial(this.getConfig().getString("spawn-egg.egg-material").toUpperCase()); assert eggMaterial != null; this.spawnEgg = new ItemStack(eggMaterial); SpawnEggMeta meta = (SpawnEggMeta) this.spawnEgg.getItemMeta(); @@ -357,6 +361,8 @@ public class EcoBoss extends PluginDependent { assert maxHealth != null; maxHealth.setBaseValue(this.getMaxHealth()); + entity.setHealth(maxHealth.getValue()); + AttributeInstance attackDamage = entity.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE); assert attackDamage != null; attackDamage.setBaseValue(this.getAttackDamage()); @@ -418,7 +424,7 @@ public class EcoBoss extends PluginDependent { for (EffectOption effect : this.getEffects()) { if (NumberUtils.randFloat(0, 100) > effect.getChance()) { - return; + continue; } player.addPotionEffect(new PotionEffect(effect.getEffectType(), effect.getDuration(), effect.getLevel())); @@ -440,7 +446,7 @@ public class EcoBoss extends PluginDependent { for (SummonsOption summon : this.getSummons()) { if (NumberUtils.randFloat(0, 100) > summon.getChance()) { - return; + continue; } Location loc = player.getLocation().add(NumberUtils.randInt(2, 6), 0, NumberUtils.randInt(2, 6)); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/listeners/AttackListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/listeners/AttackListeners.java index 1904b74..dd69dee 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/listeners/AttackListeners.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/listeners/AttackListeners.java @@ -76,9 +76,7 @@ public class AttackListeners implements Listener { return; } - if (boss.isAttackOnInjure()) { - boss.handleAttack(entity, player); - } + boss.handleAttack(entity, player); } /** diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/util/bosstype/BossEntityUtils.java b/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/util/bosstype/BossEntityUtils.java index 34453cd..8528ec0 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/util/bosstype/BossEntityUtils.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/bosses/util/bosstype/BossEntityUtils.java @@ -19,13 +19,15 @@ public class BossEntityUtils { */ @Nullable public static BossType getBossType(@NotNull final String id) { - Class> proxy = CustomEntities.getEntityClass(id.toLowerCase()); - Class type = (Class) EntityType.valueOf(id.toUpperCase()).getEntityClass(); - if (proxy != null) { - return new CustomBossType(proxy); - } - if (type != null) { + try { + Class type = (Class) EntityType.valueOf(id.toUpperCase()).getEntityClass(); + assert type != null; return new VanillaBossType(type); + } catch (IllegalArgumentException e) { + Class> proxy = CustomEntities.getEntityClass(id.toLowerCase()); + if (proxy != null) { + return new CustomBossType(proxy); + } } return null; diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/commands/CommandEbdrop.java b/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/commands/CommandEbdrop.java index 1514f86..60c34e1 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/commands/CommandEbdrop.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecobosses/commands/CommandEbdrop.java @@ -1,8 +1,11 @@ package com.willfp.ecobosses.commands; +import com.willfp.eco.util.NumberUtils; import com.willfp.eco.util.command.AbstractCommand; import com.willfp.ecobosses.EcoBossesPlugin; +import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; +import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; @@ -24,6 +27,12 @@ public class CommandEbdrop extends AbstractCommand { @NotNull final List args) { Player player = (Player) sender; ItemStack itemStack = player.getInventory().getItemInMainHand(); + String key = String.valueOf(NumberUtils.randInt(0, 100000)); + YamlConfiguration jank = new YamlConfiguration(); + jank.set(key, itemStack); + + Bukkit.getLogger().info("Copy this into the drops section of your boss yml!"); + Bukkit.getLogger().info("\n" + jank.saveToString()); player.sendMessage(this.getPlugin().getLangYml().getMessage("sent-drop")); } diff --git a/eco-core/core-plugin/src/main/resources/bosses/illusioner.yml b/eco-core/core-plugin/src/main/resources/bosses/illusioner.yml index eb14e4f..3bfccfd 100644 --- a/eco-core/core-plugin/src/main/resources/bosses/illusioner.yml +++ b/eco-core/core-plugin/src/main/resources/bosses/illusioner.yml @@ -4,7 +4,7 @@ name: "Illusioner" # Display name base-mob: custom_illusioner # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin) spawn-egg: - egg-material: illusioner_spawn_egg + egg-material: squid_spawn_egg display-name: "Illusioner Spawn Egg" lore: [] @@ -76,7 +76,7 @@ sounds: spawn: # On spawn - "entity_illusioner_mirror_move:1000:0.5" - - "entity_wither_spawn:1000L:2" + - "entity_wither_spawn:1000:2" death: # On death - "entity_evoker_prepare_wololo:50:0.8" diff --git a/eco-core/core-plugin/src/main/resources/plugin.yml b/eco-core/core-plugin/src/main/resources/plugin.yml index 519b745..7e74e0c 100644 --- a/eco-core/core-plugin/src/main/resources/plugin.yml +++ b/eco-core/core-plugin/src/main/resources/plugin.yml @@ -5,6 +5,8 @@ api-version: 1.15 authors: [Auxilor] website: willfp.com load: STARTUP +depend: + - eco commands: ebreload: