mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2026-01-02 22:02:19 +00:00
Merge pull request #138
Screwed the @ConfigUpdater, fixed custom skills/effects/stats loading
This commit is contained in:
@@ -54,4 +54,11 @@ public final class CustomEffects extends ConfigCategory {
|
||||
@NotNull final Config config) {
|
||||
REGISTRY.register(new CustomEffect(id, config));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterReload(@NotNull LibreforgePlugin plugin) {
|
||||
for (CustomEffect effect : REGISTRY.values()) {
|
||||
effect.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,6 @@ public final class Effects {
|
||||
return ImmutableSet.copyOf(REGISTRY.values());
|
||||
}
|
||||
|
||||
@ConfigUpdater
|
||||
public static void update() {
|
||||
for (Effect effect : Effects.values()) {
|
||||
effect.update();
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.willfp.ecoskills.skills;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.willfp.eco.core.config.interfaces.Config;
|
||||
import com.willfp.eco.core.registry.Registry;
|
||||
import com.willfp.ecoskills.effects.CustomEffect;
|
||||
import com.willfp.libreforge.loader.LibreforgePlugin;
|
||||
import com.willfp.libreforge.loader.configs.ConfigCategory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -43,4 +44,11 @@ public final class CustomSkills extends ConfigCategory {
|
||||
@NotNull final Config config) {
|
||||
REGISTRY.register(new CustomSkill(id, config));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterReload(@NotNull LibreforgePlugin plugin) {
|
||||
for (CustomSkill skill : REGISTRY.values()) {
|
||||
skill.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,6 @@ public class Skills {
|
||||
return ImmutableSet.copyOf(REGISTRY.values());
|
||||
}
|
||||
|
||||
@ConfigUpdater
|
||||
public static void update(@NotNull final EcoSkillsPlugin plugin) {
|
||||
new PlayerPlaceholder(
|
||||
plugin,
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.willfp.ecoskills.stats;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.willfp.eco.core.config.interfaces.Config;
|
||||
import com.willfp.eco.core.registry.Registry;
|
||||
import com.willfp.ecoskills.skills.CustomSkill;
|
||||
import com.willfp.libreforge.loader.LibreforgePlugin;
|
||||
import com.willfp.libreforge.loader.configs.ConfigCategory;
|
||||
import com.willfp.libreforge.loader.configs.LegacyLocation;
|
||||
@@ -52,4 +53,11 @@ public final class CustomStats extends ConfigCategory {
|
||||
@NotNull final Config config) {
|
||||
registry.register(new CustomStat(id, config));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterReload(@NotNull LibreforgePlugin plugin) {
|
||||
for (CustomStat stat : registry.values()) {
|
||||
stat.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ public class Stats {
|
||||
return ImmutableSet.copyOf(REGISTRY.values());
|
||||
}
|
||||
|
||||
@ConfigUpdater
|
||||
public static void update(@NotNull final EcoSkillsPlugin plugin) {
|
||||
for (Stat stat : Stats.values()) {
|
||||
stat.update();
|
||||
|
||||
@@ -13,12 +13,15 @@ import com.willfp.ecoskills.actionbar.ActionBarUtils.startRunnable
|
||||
import com.willfp.ecoskills.actionbar.HealthScaleListener
|
||||
import com.willfp.ecoskills.commands.CommandEcoSkills
|
||||
import com.willfp.ecoskills.commands.CommandSkills
|
||||
import com.willfp.ecoskills.commands.TabCompleteHelper
|
||||
import com.willfp.ecoskills.config.EffectsYml
|
||||
import com.willfp.ecoskills.data.DataListener
|
||||
import com.willfp.ecoskills.data.LeaderboardHandler
|
||||
import com.willfp.ecoskills.effects.CustomEffects
|
||||
import com.willfp.ecoskills.effects.Effects
|
||||
import com.willfp.ecoskills.effects.customEffects
|
||||
import com.willfp.ecoskills.gui.SkillGUI
|
||||
import com.willfp.ecoskills.gui.StatsGUI
|
||||
import com.willfp.ecoskills.integrations.EcoEnchantsEnchantingLeveller
|
||||
import com.willfp.ecoskills.integrations.enchantgui.EnchantGuiHandler
|
||||
import com.willfp.ecoskills.libreforge.ConditionHasSkillLevel
|
||||
@@ -76,6 +79,11 @@ class EcoSkillsPlugin : LibreforgePlugin() {
|
||||
|
||||
EcoSkillsTopPlaceholder.register(this)
|
||||
Skills.update(this)
|
||||
Effects.update()
|
||||
Stats.update(this)
|
||||
StatsGUI.update(this)
|
||||
SkillGUI.update(this)
|
||||
TabCompleteHelper.update()
|
||||
|
||||
registerHolderProvider { it.customEffects.map { h -> SimpleProvidedHolder(h) } }
|
||||
registerHolderProvider { it.customStats.map { h -> SimpleProvidedHolder(h) } }
|
||||
@@ -101,6 +109,12 @@ class EcoSkillsPlugin : LibreforgePlugin() {
|
||||
|
||||
tickBossBars(this)
|
||||
scheduler.runAsyncTimer(LeaderboardHandler.Runnable(), 50, 2400)
|
||||
Skills.update(this)
|
||||
Effects.update()
|
||||
Stats.update(this)
|
||||
StatsGUI.update(this)
|
||||
SkillGUI.update(this)
|
||||
TabCompleteHelper.update()
|
||||
}
|
||||
|
||||
override fun loadListeners(): List<Listener> {
|
||||
|
||||
@@ -44,7 +44,6 @@ object TabCompleteHelper {
|
||||
/**
|
||||
* Update lists.
|
||||
*/
|
||||
@ConfigUpdater
|
||||
@JvmStatic
|
||||
fun update() {
|
||||
SKILL_NAMES.clear()
|
||||
|
||||
@@ -20,8 +20,6 @@ object SkillGUI {
|
||||
@JvmStatic
|
||||
private lateinit var menu: Menu
|
||||
|
||||
@JvmStatic
|
||||
@ConfigUpdater
|
||||
fun update(plugin: EcoSkillsPlugin) {
|
||||
menu = buildHomeMenu(plugin)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ object StatsGUI {
|
||||
private lateinit var menu: Menu
|
||||
|
||||
@JvmStatic
|
||||
@ConfigUpdater
|
||||
fun update(plugin: EcoSkillsPlugin) {
|
||||
menu = buildStatsMenu(plugin)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user