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 eb94f98..53170cf 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 @@ -281,6 +281,7 @@ public class EcoBoss extends PluginDependent { ItemStack itemStack = tempConfig.getItemStack("drop-key"); this.drops.put(itemStack, chance); } + this.experienceOptions = new ExperienceOptions( this.getConfig().getInt("rewards.xp.minimum"), this.getConfig().getInt("rewards.xp.maximum") 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 39e9a4b..368c37c 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 @@ -66,7 +66,6 @@ public class LivingEcoBoss extends PluginDependent { this.onSpawn(); - // Tickers this.tickers = new HashSet<>(); this.tickers.add(new HealthPlaceholderTicker()); @@ -91,58 +90,6 @@ public class LivingEcoBoss extends PluginDependent { }).runTaskTimer(0, 1); } - /** - * Handle an attack to the player. - * - * @param player The player. - */ - public void handleAttack(@NotNull final Player player) { - for (OptionedSound sound : boss.getInjureSounds()) { - player.getWorld().playSound(entity.getLocation(), sound.getSound(), sound.getVolume(), sound.getPitch()); - } - - for (EffectOption effect : boss.getEffects()) { - if (NumberUtils.randFloat(0, 100) > effect.getChance()) { - continue; - } - - player.addPotionEffect(new PotionEffect(effect.getEffectType(), effect.getDuration(), effect.getLevel())); - } - - if (NumberUtils.randFloat(0, 100) < boss.getShuffleChance()) { - List hotbar = new ArrayList<>(); - for (int i = 0; i < 9; i++) { - hotbar.add(player.getInventory().getItem(i)); - } - Collections.shuffle(hotbar); - int i2 = 0; - for (ItemStack item : hotbar) { - player.getInventory().setItem(i2, item); - i2++; - } - player.playSound(player.getLocation(), Sound.ENTITY_ENDER_PEARL_THROW, 1, 0.5f); - } - - for (SummonsOption summon : boss.getSummons()) { - if (NumberUtils.randFloat(0, 100) > summon.getChance()) { - continue; - } - - Location loc = player.getLocation().add(NumberUtils.randInt(2, 6), 0, NumberUtils.randInt(2, 6)); - while (!loc.getBlock().getType().equals(Material.AIR)) { - loc.add(0, 1, 0); - } - Entity summonedEntity = player.getWorld().spawnEntity(loc, summon.getType()); - if (summonedEntity instanceof Mob) { - ((Mob) summonedEntity).setTarget(player); - } - - for (OptionedSound sound : boss.getSummonSounds()) { - player.getWorld().playSound(entity.getLocation(), sound.getSound(), sound.getVolume(), sound.getPitch()); - } - } - } - private void onSpawn() { entity.getPersistentDataContainer().set(this.getPlugin().getNamespacedKeyFactory().create("boss"), PersistentDataType.STRING, boss.getName()); entity.setPersistent(true); @@ -196,4 +143,56 @@ public class LivingEcoBoss extends PluginDependent { boss.removeLivingBoss(entity.getUniqueId()); } } + + /** + * Handle an attack to the player. + * + * @param player The player. + */ + public void handleAttack(@NotNull final Player player) { + for (OptionedSound sound : boss.getInjureSounds()) { + player.getWorld().playSound(entity.getLocation(), sound.getSound(), sound.getVolume(), sound.getPitch()); + } + + for (EffectOption effect : boss.getEffects()) { + if (NumberUtils.randFloat(0, 100) > effect.getChance()) { + continue; + } + + player.addPotionEffect(new PotionEffect(effect.getEffectType(), effect.getDuration(), effect.getLevel())); + } + + if (NumberUtils.randFloat(0, 100) < boss.getShuffleChance()) { + List hotbar = new ArrayList<>(); + for (int i = 0; i < 9; i++) { + hotbar.add(player.getInventory().getItem(i)); + } + Collections.shuffle(hotbar); + int i2 = 0; + for (ItemStack item : hotbar) { + player.getInventory().setItem(i2, item); + i2++; + } + player.playSound(player.getLocation(), Sound.ENTITY_ENDER_PEARL_THROW, 1, 0.5f); + } + + for (SummonsOption summon : boss.getSummons()) { + if (NumberUtils.randFloat(0, 100) > summon.getChance()) { + continue; + } + + Location loc = player.getLocation().add(NumberUtils.randInt(2, 6), 0, NumberUtils.randInt(2, 6)); + while (!loc.getBlock().getType().equals(Material.AIR)) { + loc.add(0, 1, 0); + } + Entity summonedEntity = player.getWorld().spawnEntity(loc, summon.getType()); + if (summonedEntity instanceof Mob) { + ((Mob) summonedEntity).setTarget(player); + } + + for (OptionedSound sound : boss.getSummonSounds()) { + player.getWorld().playSound(entity.getLocation(), sound.getSound(), sound.getVolume(), sound.getPitch()); + } + } + } }