diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 176 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt | 18 |
2 files changed, 97 insertions, 97 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 893792936..c59444b99 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -70,7 +70,7 @@ public class SkyHanniMod { public static ConfigManager configManager; private static Logger logger; - public static List<Object> listenerClasses = new ArrayList<>(); + public static List<Object> modules = new ArrayList<>(); public static Job globalJob = JobKt.Job(null); public static CoroutineScope coroutineScope = CoroutineScopeKt.CoroutineScope( @@ -84,97 +84,97 @@ public class SkyHanniMod { //API and utils new BazaarApi(); - registerEvent(this); - registerEvent(new ChatManager()); - registerEvent(new HypixelData()); - registerEvent(new DungeonData()); - registerEvent(new ScoreboardData()); - registerEvent(new ApiDataLoader()); - registerEvent(new SeaCreatureManager()); - registerEvent(new ItemRenderBackground()); - registerEvent(new EntityData()); - registerEvent(new EntityMovementData()); - registerEvent(new ItemClickData()); - registerEvent(new MinecraftData()); - registerEvent(new SendTitleHelper()); - registerEvent(new ItemTipHelper()); + loadModule(this); + loadModule(new ChatManager()); + loadModule(new HypixelData()); + loadModule(new DungeonData()); + loadModule(new ScoreboardData()); + loadModule(new ApiDataLoader()); + loadModule(new SeaCreatureManager()); + loadModule(new ItemRenderBackground()); + loadModule(new EntityData()); + loadModule(new EntityMovementData()); + loadModule(new ItemClickData()); + loadModule(new MinecraftData()); + loadModule(new SendTitleHelper()); + loadModule(new ItemTipHelper()); //features - registerEvent(new BazaarOrderHelper()); - registerEvent(new ChatFilter()); - registerEvent(new PlayerChatModifier()); - registerEvent(new DungeonChatFilter()); - registerEvent(new HideNotClickableItems()); - registerEvent(new ItemDisplayOverlayFeatures()); - registerEvent(new CurrentPetDisplay()); - registerEvent(new ExpBottleOnGroundHider()); - registerEvent(new DamageIndicatorManager()); - registerEvent(new ItemAbilityCooldown()); - registerEvent(new DungeonHighlightClickedBlocks()); - registerEvent(new DungeonMilestonesDisplay()); - registerEvent(new DungeonDeathCounter()); - registerEvent(new DungeonCleanEnd()); - registerEvent(new DungeonBossMessages()); - registerEvent(new DungeonBossHideDamageSplash()); - registerEvent(new TrophyFishMessages()); - registerEvent(new BazaarBestSellMethod()); - registerEvent(new AnvilCombineHelper()); - registerEvent(new SeaCreatureMessageShortener()); + loadModule(new BazaarOrderHelper()); + loadModule(new ChatFilter()); + loadModule(new PlayerChatModifier()); + loadModule(new DungeonChatFilter()); + loadModule(new HideNotClickableItems()); + loadModule(new ItemDisplayOverlayFeatures()); + loadModule(new CurrentPetDisplay()); + loadModule(new ExpBottleOnGroundHider()); + loadModule(new DamageIndicatorManager()); + loadModule(new ItemAbilityCooldown()); + loadModule(new DungeonHighlightClickedBlocks()); + loadModule(new DungeonMilestonesDisplay()); + loadModule(new DungeonDeathCounter()); + loadModule(new DungeonCleanEnd()); + loadModule(new DungeonBossMessages()); + loadModule(new DungeonBossHideDamageSplash()); + loadModule(new TrophyFishMessages()); + loadModule(new BazaarBestSellMethod()); + loadModule(new AnvilCombineHelper()); + loadModule(new SeaCreatureMessageShortener()); // registerEvent(new GriffinBurrowFinder()); - registerEvent(new AshfangFreezeCooldown()); - registerEvent(new AshfangNextResetCooldown()); - registerEvent(new SummoningSoulsName()); - registerEvent(new AshfangGravityOrbs()); - registerEvent(new AshfangBlazingSouls()); - registerEvent(new AshfangBlazes()); - registerEvent(new AshfangHideParticles()); - registerEvent(new AshfangHideDamageIndicator()); - registerEvent(new ItemStars()); - registerEvent(new MinionFeatures()); - registerEvent(new RealTime()); - registerEvent(new RngMeterInventory()); - registerEvent(new WikiCommand()); - registerEvent(new SummoningMobManager()); - registerEvent(new VoidlingExtremistColor()); - registerEvent(new MilleniaAgedBlazeColor()); - registerEvent(new CorruptedMobHighlight()); - registerEvent(new MarkedPlayerManager()); - registerEvent(new HighlightSlayerMiniboss()); - registerEvent(new PlayerDeathMessages()); - registerEvent(new HighlightDungeonDeathmite()); - registerEvent(new DungeonHideItems()); - registerEvent(new DungeonCopilot()); - registerEvent(new EndermanSlayerBeacon()); - registerEvent(new FireVeilWandParticles()); - registerEvent(new HideMobNames()); - registerEvent(new HideDamageSplash()); - registerEvent(new ThunderSparksHighlight()); - registerEvent(new BlazeSlayerPillar()); - registerEvent(new BlazeSlayerDaggerHelper()); - registerEvent(new HellionShieldHelper()); - registerEvent(new BlazeSlayerFirePitsWarning()); - registerEvent(new BlazeSlayerClearView()); - registerEvent(new PlayerChatFilter()); - registerEvent(new HideArmor()); - registerEvent(new SlayerQuestWarning()); - registerEvent(new StatsTuning()); - registerEvent(new NonGodPotEffectDisplay()); - registerEvent(new SoopyGuessBurrow()); - registerEvent(new GriffinBurrowHelper()); - registerEvent(new GriffinBurrowParticleFinder()); - registerEvent(new BurrowWarpHelper()); - registerEvent(new CollectionCounter()); - registerEvent(new HighlightBonzoMasks()); - registerEvent(new DungeonLevelColor()); - registerEvent(new BazaarCancelledBuyOrderClipboard()); - registerEvent(new CompactSplashPotionMessage()); - registerEvent(new CroesusUnopenedChestTracker()); - registerEvent(new CompactBingoChat()); + loadModule(new AshfangFreezeCooldown()); + loadModule(new AshfangNextResetCooldown()); + loadModule(new SummoningSoulsName()); + loadModule(new AshfangGravityOrbs()); + loadModule(new AshfangBlazingSouls()); + loadModule(new AshfangBlazes()); + loadModule(new AshfangHideParticles()); + loadModule(new AshfangHideDamageIndicator()); + loadModule(new ItemStars()); + loadModule(new MinionFeatures()); + loadModule(new RealTime()); + loadModule(new RngMeterInventory()); + loadModule(new WikiCommand()); + loadModule(new SummoningMobManager()); + loadModule(new VoidlingExtremistColor()); + loadModule(new MilleniaAgedBlazeColor()); + loadModule(new CorruptedMobHighlight()); + loadModule(new MarkedPlayerManager()); + loadModule(new HighlightSlayerMiniboss()); + loadModule(new PlayerDeathMessages()); + loadModule(new HighlightDungeonDeathmite()); + loadModule(new DungeonHideItems()); + loadModule(new DungeonCopilot()); + loadModule(new EndermanSlayerBeacon()); + loadModule(new FireVeilWandParticles()); + loadModule(new HideMobNames()); + loadModule(new HideDamageSplash()); + loadModule(new ThunderSparksHighlight()); + loadModule(new BlazeSlayerPillar()); + loadModule(new BlazeSlayerDaggerHelper()); + loadModule(new HellionShieldHelper()); + loadModule(new BlazeSlayerFirePitsWarning()); + loadModule(new BlazeSlayerClearView()); + loadModule(new PlayerChatFilter()); + loadModule(new HideArmor()); + loadModule(new SlayerQuestWarning()); + loadModule(new StatsTuning()); + loadModule(new NonGodPotEffectDisplay()); + loadModule(new SoopyGuessBurrow()); + loadModule(new GriffinBurrowHelper()); + loadModule(new GriffinBurrowParticleFinder()); + loadModule(new BurrowWarpHelper()); + loadModule(new CollectionCounter()); + loadModule(new HighlightBonzoMasks()); + loadModule(new DungeonLevelColor()); + loadModule(new BazaarCancelledBuyOrderClipboard()); + loadModule(new CompactSplashPotionMessage()); + loadModule(new CroesusUnopenedChestTracker()); + loadModule(new CompactBingoChat()); Commands.INSTANCE.init(); - registerEvent(new LorenzTest()); - registerEvent(new ButtonOnPause()); + loadModule(new LorenzTest()); + loadModule(new ButtonOnPause()); configManager = new ConfigManager(); configManager.firstLoad(); @@ -186,8 +186,8 @@ public class SkyHanniMod { repo.loadRepoInformation(); } - private void registerEvent(Object object) { - listenerClasses.add(object); + private void loadModule(Object object) { + modules.add(object); MinecraftForge.EVENT_BUS.register(object); } diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index 3f1cfa4da..dce81b5df 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -83,25 +83,25 @@ class LorenzTest { emptyList() } - val listeners = SkyHanniMod.listenerClasses - for (oldListener in listeners.toMutableList()) { - val javaClass = oldListener.javaClass + val modules = SkyHanniMod.modules + for (original in modules.toMutableList()) { + val javaClass = original.javaClass val simpleName = javaClass.simpleName - MinecraftForge.EVENT_BUS.unregister(oldListener) + MinecraftForge.EVENT_BUS.unregister(original) println("Unregistered listener $simpleName") if (simpleName !in blockedFeatures) { - listeners.remove(oldListener) - val newListener = javaClass.newInstance() - listeners.add(newListener) + modules.remove(original) + val module = javaClass.newInstance() + modules.add(module) - MinecraftForge.EVENT_BUS.register(newListener) + MinecraftForge.EVENT_BUS.register(module) println("Registered listener $simpleName") } else { println("Skipped registering listener $simpleName") } } - LorenzUtils.chat("§e[SkyHanni] reloaded ${listeners.size} listener classes.") + LorenzUtils.chat("§e[SkyHanni] reloaded ${modules.size} listener classes.") } } |