mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-21 16:09:24 +00:00
Finished config loading
This commit is contained in:
@@ -5,12 +5,12 @@ import com.willfp.eco.util.display.DisplayModule;
|
||||
import com.willfp.eco.util.integrations.IntegrationLoader;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||
import com.willfp.ecobosses.commands.CommandEbdrop;
|
||||
import com.willfp.ecobosses.commands.CommandEbreload;
|
||||
import com.willfp.ecobosses.config.EcoBossesConfigs;
|
||||
import com.willfp.ecobosses.bosses.EcoBosses;
|
||||
import com.willfp.ecobosses.bosses.listeners.AttackListeners;
|
||||
import com.willfp.ecobosses.bosses.listeners.DeathListeners;
|
||||
import com.willfp.ecobosses.bosses.listeners.SpawnListeners;
|
||||
import com.willfp.ecobosses.commands.CommandEbdrop;
|
||||
import com.willfp.ecobosses.commands.CommandEbreload;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -64,7 +64,7 @@ public class EcoBossesPlugin extends AbstractEcoPlugin {
|
||||
*/
|
||||
@Override
|
||||
public void onReload() {
|
||||
IllusionerManager.OPTIONS.reload();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +125,7 @@ public class EcoBossesPlugin extends AbstractEcoPlugin {
|
||||
@Override
|
||||
public List<Class<?>> getUpdatableClasses() {
|
||||
return Arrays.asList(
|
||||
EcoBossesConfigs.class
|
||||
EcoBosses.class
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.willfp.ecobosses.bosses;
|
||||
|
||||
import com.willfp.eco.internal.config.AbstractUndefinedConfig;
|
||||
import com.willfp.eco.util.StringUtils;
|
||||
import com.willfp.eco.util.internal.PluginDependent;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
import com.willfp.ecobosses.bosses.util.bosstype.BossEntityUtils;
|
||||
import com.willfp.ecobosses.bosses.util.bosstype.BossType;
|
||||
import com.willfp.ecobosses.bosses.util.obj.BossbarProperties;
|
||||
import com.willfp.ecobosses.bosses.util.obj.ExperienceOptions;
|
||||
@@ -16,19 +18,24 @@ import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarFlag;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SpawnEggMeta;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
@@ -181,6 +188,9 @@ public class EcoBoss extends PluginDependent {
|
||||
|
||||
this.displayName = this.getConfig().getString("name");
|
||||
|
||||
// Boss Type
|
||||
this.bossType = BossEntityUtils.getBossType(this.getConfig().getString("base-mob"));
|
||||
|
||||
// Boss Bar
|
||||
this.bossbarEnabled = this.getConfig().getBool("bossbar.enabled");
|
||||
this.bossbarProperties = new BossbarProperties(
|
||||
@@ -219,6 +229,91 @@ public class EcoBoss extends PluginDependent {
|
||||
this.getConfig().getBool("defence.immunities.explosion")
|
||||
);
|
||||
|
||||
// Effects
|
||||
this.effects = new HashSet<>();
|
||||
for (String string : this.getConfig().getStrings("attacks.potion-effects")) {
|
||||
String[] split = string.split(":");
|
||||
PotionEffectType type = PotionEffectType.getByName(split[0].toUpperCase());
|
||||
assert type != null;
|
||||
this.effects.add(new EffectOption(
|
||||
Double.parseDouble(split[3]),
|
||||
Integer.parseInt(split[1]) - 1,
|
||||
Integer.parseInt(split[2]),
|
||||
type
|
||||
));
|
||||
}
|
||||
|
||||
// Summons
|
||||
this.summons = new HashSet<>();
|
||||
for (String string : this.getConfig().getStrings("attacks.summons")) {
|
||||
String[] split = string.split(":");
|
||||
this.summons.add(new SummonsOption(
|
||||
Double.parseDouble(split[1]),
|
||||
EntityType.valueOf(split[0].toUpperCase())
|
||||
));
|
||||
}
|
||||
|
||||
// Shuffle
|
||||
this.shuffleChance = this.getConfig().getDouble("attacks.shuffle-chance");
|
||||
|
||||
// Attack on injure
|
||||
this.attackOnInjure = this.getConfig().getBool("attacks.on-injure");
|
||||
|
||||
// Sounds
|
||||
this.injureSounds = new ArrayList<>();
|
||||
for (String string : this.getConfig().getStrings("sounds.injure")) {
|
||||
String[] split = string.split(":");
|
||||
this.injureSounds.add(new OptionedSound(
|
||||
Sound.valueOf(split[0].toUpperCase()),
|
||||
Float.parseFloat(split[1]),
|
||||
Float.parseFloat(split[2])
|
||||
));
|
||||
}
|
||||
|
||||
this.deathSounds = new ArrayList<>();
|
||||
for (String string : this.getConfig().getStrings("sounds.death")) {
|
||||
String[] split = string.split(":");
|
||||
this.deathSounds.add(new OptionedSound(
|
||||
Sound.valueOf(split[0].toUpperCase()),
|
||||
Float.parseFloat(split[1]),
|
||||
Float.parseFloat(split[2])
|
||||
));
|
||||
}
|
||||
|
||||
this.summonSounds = new ArrayList<>();
|
||||
for (String string : this.getConfig().getStrings("sounds.summon")) {
|
||||
String[] split = string.split(":");
|
||||
this.summonSounds.add(new OptionedSound(
|
||||
Sound.valueOf(split[0].toUpperCase()),
|
||||
Float.parseFloat(split[1]),
|
||||
Float.parseFloat(split[2])
|
||||
));
|
||||
}
|
||||
|
||||
this.spawnSounds = new ArrayList<>();
|
||||
for (String string : this.getConfig().getStrings("sounds.spawn")) {
|
||||
String[] split = string.split(":");
|
||||
this.spawnSounds.add(new OptionedSound(
|
||||
Sound.valueOf(split[0].toUpperCase()),
|
||||
Float.parseFloat(split[1]),
|
||||
Float.parseFloat(split[2])
|
||||
));
|
||||
}
|
||||
|
||||
// Spawn egg
|
||||
Material eggMaterial = Material.matchMaterial("spawn-egg.egg-material");
|
||||
assert eggMaterial != null;
|
||||
this.spawnEgg = new ItemStack(eggMaterial);
|
||||
SpawnEggMeta meta = (SpawnEggMeta) this.spawnEgg.getItemMeta();
|
||||
assert meta != null;
|
||||
List<String> lore = new ArrayList<>();
|
||||
for (String string : this.getConfig().getStrings("spawn-egg.lore")) {
|
||||
lore.add(StringUtils.translate(string));
|
||||
}
|
||||
meta.setLore(lore);
|
||||
meta.setDisplayName(this.getConfig().getString("spawn-egg.display-name"));
|
||||
meta.getPersistentDataContainer().set(this.getPlugin().getNamespacedKeyFactory().create("spawn_egg"), PersistentDataType.STRING, this.getName());
|
||||
this.spawnEgg.setItemMeta(meta);
|
||||
|
||||
if (this.getConfig().getBool("enabled")) {
|
||||
EcoBosses.addBoss(this);
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.willfp.eco.util.internal.PluginDependent;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
import com.willfp.ecobosses.bosses.util.obj.attacks.EffectOption;
|
||||
import com.willfp.ecobosses.bosses.util.obj.OptionedSound;
|
||||
import com.willfp.ecobosses.config.EcoBossesConfigs;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.willfp.eco.util.NumberUtils;
|
||||
import com.willfp.eco.util.internal.PluginDependent;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
import com.willfp.eco.util.tuples.Pair;
|
||||
import com.willfp.ecobosses.config.EcoBossesConfigs;
|
||||
import com.willfp.ecobosses.bosses.util.obj.SpawnTotem;
|
||||
import com.willfp.ecobosses.bosses.util.obj.OptionedSound;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.willfp.ecobosses.config;
|
||||
|
||||
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@UtilityClass
|
||||
public class EcoBossesConfigs {
|
||||
/**
|
||||
* Update all configs.
|
||||
*/
|
||||
@ConfigUpdater
|
||||
public void updateConfigs() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,6 @@ public class BaseBossConfig extends ExtendableConfig {
|
||||
* @param configName The name of the config.
|
||||
*/
|
||||
public BaseBossConfig(@NotNull final String configName) {
|
||||
super(configName, true, EcoBossesPlugin.getInstance(), EcoBossesPlugin.class, "bosses/");
|
||||
super(configName, false, EcoBossesPlugin.getInstance(), EcoBossesPlugin.class, "bosses/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 2.5.4
|
||||
plugin-name = Illusioner
|
||||
version = 3.0.0
|
||||
plugin-name = EcoBosses
|
||||
Reference in New Issue
Block a user