diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 2287a640e5fb..355dd0e3e2a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -272,6 +272,7 @@ import at.hannibal2.skyhanni.features.inventory.SuperCraftFeatures import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarBestSellMethod import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarCancelledBuyOrderClipboard +import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarDataHolder import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarOpenPriceWebsite import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarOrderHelper import at.hannibal2.skyhanni.features.inventory.bazaar.CraftMaterialsFromBazaar @@ -500,7 +501,7 @@ class SkyHanniMod { loadModule(ActionBarAPI) loadModule(ActionBarStatsData) loadModule(AdvancedPlayerList) - loadModule(BingoCardReader()) + loadModule(BingoCardReader) loadModule(BlockChangeAPI) loadModule(BossbarAPI) loadModule(ChatManager) @@ -508,50 +509,50 @@ class SkyHanniMod { loadModule(ChromaManager) loadModule(ContributorManager) loadModule(CropAccessoryData) - loadModule(DeepCavernsGuide()) + loadModule(DeepCavernsGuide) loadModule(DefaultConfigFeatures) loadModule(DungeonAPI) - loadModule(DungeonsRaceGuide()) + loadModule(DungeonsRaceGuide) loadModule(EntityAttributeAPI) - loadModule(EntityMovementData()) + loadModule(EntityMovementData) loadModule(EntityOutlineRenderer) loadModule(EntityUtils) loadModule(EventCounter) - loadModule(FixedRateTimerManager()) - loadModule(GardenBestCropTime()) - loadModule(GardenComposterUpgradesData()) - loadModule(GardenCropMilestoneInventory()) + loadModule(FixedRateTimerManager) + loadModule(GardenBestCropTime) + loadModule(GardenComposterUpgradesData) + loadModule(GardenCropMilestoneInventory) loadModule(GardenCropMilestones) loadModule(GardenCropMilestonesCommunityFix) loadModule(GardenCropSpeed) - loadModule(GardenCropUpgrades()) - loadModule(GardenWarpCommands()) + loadModule(GardenCropUpgrades) + loadModule(GardenWarpCommands) loadModule(GetFromSackAPI) loadModule(GuiData) - loadModule(GuiEditManager()) - loadModule(HighlightVisitorsOutsideOfGarden()) + loadModule(GuiEditManager) + loadModule(HighlightVisitorsOutsideOfGarden) loadModule(HypixelBazaarFetcher) loadModule(HypixelData) - loadModule(ItemAddManager()) - loadModule(ItemClickData()) - loadModule(ItemTipHelper()) + loadModule(ItemAddManager) + loadModule(ItemClickData) + loadModule(ItemTipHelper) loadModule(KeyboardManager) loadModule(LocationFixData) loadModule(MinecraftData) loadModule(MobData()) loadModule(MobDetection()) loadModule(OtherInventoryData) - loadModule(OwnInventoryData()) + loadModule(OwnInventoryData) loadModule(PlayerChatManager()) loadModule(PlayerNameFormatter()) loadModule(ProfileStorageData) - loadModule(RenderData()) - loadModule(RenderLivingEntityHelper()) - loadModule(ScoreboardData()) + loadModule(RenderData) + loadModule(RenderLivingEntityHelper) + loadModule(ScoreboardData) loadModule(ScoreboardPattern) loadModule(ScreenData) - loadModule(SeaCreatureFeatures()) - loadModule(SeaCreatureManager()) + loadModule(SeaCreatureFeatures) + loadModule(SeaCreatureManager) loadModule(SkillExperience) loadModule(TabComplete) loadModule(TabListData) @@ -560,12 +561,13 @@ class SkyHanniMod { loadModule(TrackerManager) loadModule(UpdateManager) loadModule(UtilsPatterns) - loadModule(VisitorListener()) - loadModule(VisitorRewardWarning()) + loadModule(VisitorListener) + loadModule(VisitorRewardWarning) // loadModule(Year300RaffleEvent) // APIs - loadModule(BazaarApi()) + loadModule(BazaarApi) + loadModule(BazaarDataHolder) loadModule(BingoAPI) loadModule(BitsAPI) loadModule(ChocolateFactoryAPI) @@ -600,358 +602,358 @@ class SkyHanniMod { loadModule(VisitorAPI) // features - loadModule(AccountUpgradeReminder()) + loadModule(AccountUpgradeReminder) loadModule(AllBurrowsList) - loadModule(AnitaExtraFarmingFortune()) - loadModule(AnitaMedalProfit()) - loadModule(AnvilCombineHelper()) - loadModule(ArachneChatMessageHider()) - loadModule(AreaMiniBossFeatures()) + loadModule(AnitaExtraFarmingFortune) + loadModule(AnitaMedalProfit) + loadModule(AnvilCombineHelper) + loadModule(ArachneChatMessageHider) + loadModule(AreaMiniBossFeatures) loadModule(ArmorDropTracker) - loadModule(ArrowTrail()) - loadModule(AshfangBlazes()) - loadModule(AshfangBlazingSouls()) + loadModule(ArrowTrail) + loadModule(AshfangBlazes) + loadModule(AshfangBlazingSouls) loadModule(AshfangFreezeCooldown) - loadModule(AshfangGravityOrbs()) - loadModule(AshfangHideDamageIndicator()) - loadModule(AshfangHideParticles()) - loadModule(AshfangMinisNametagHider()) - loadModule(AshfangNextResetCooldown()) - loadModule(AtmosphericFilterDisplay()) + loadModule(AshfangGravityOrbs) + loadModule(AshfangHideDamageIndicator) + loadModule(AshfangHideParticles) + loadModule(AshfangMinisNametagHider) + loadModule(AshfangNextResetCooldown) + loadModule(AtmosphericFilterDisplay) loadModule(AuctionHouseCopyUnderbidPrice()) loadModule(AuctionHousePriceComparison()) loadModule(AuctionsHighlighter) - loadModule(BasketWaypoints()) - loadModule(BazaarBestSellMethod()) - loadModule(BazaarCancelledBuyOrderClipboard()) - loadModule(BazaarOpenPriceWebsite()) - loadModule(BazaarOrderHelper()) + loadModule(BasketWaypoints) + loadModule(BazaarBestSellMethod) + loadModule(BazaarCancelledBuyOrderClipboard) + loadModule(BazaarOpenPriceWebsite) + loadModule(BazaarOrderHelper) loadModule(BestiaryData) - loadModule(BetterSignEditing()) - loadModule(BetterWikiFromMenus()) - loadModule(BingoCardDisplay()) - loadModule(BingoCardTips()) - loadModule(BingoNextStepHelper()) - loadModule(BlazeSlayerClearView()) - loadModule(BlazeSlayerDaggerHelper()) - loadModule(BlazeSlayerFirePitsWarning()) - loadModule(BlobbercystsHighlight()) - loadModule(BrewingStandOverlay()) - loadModule(BurrowWarpHelper()) + loadModule(BetterSignEditing) + loadModule(BetterWikiFromMenus) + loadModule(BingoCardDisplay) + loadModule(BingoCardTips) + loadModule(BingoNextStepHelper) + loadModule(BlazeSlayerClearView) + loadModule(BlazeSlayerDaggerHelper) + loadModule(BlazeSlayerFirePitsWarning) + loadModule(BlobbercystsHighlight) + loadModule(BrewingStandOverlay) + loadModule(BurrowWarpHelper) loadModule(CaptureFarmingGear) - loadModule(ChatFilter()) - loadModule(ChestValue()) - loadModule(ChickenHeadTimer()) + loadModule(ChatFilter) + loadModule(ChestValue) + loadModule(ChickenHeadTimer) loadModule(ChocolateFactoryBarnManager) loadModule(ChocolateFactoryCustomReminder) loadModule(ChocolateFactoryDataLoader) loadModule(ChocolateFactoryInventory) loadModule(ChocolateFactoryKeybinds) - loadModule(ChocolateFactoryShortcut()) + loadModule(ChocolateFactoryShortcut) loadModule(ChocolateFactoryStats) loadModule(ChocolateFactoryTimeTowerManager) loadModule(ChocolateFactoryTooltip) loadModule(ChocolateFactoryTooltipCompact) loadModule(ChocolateFactoryUpgradeWarning) loadModule(ChocolateShopPrice) - loadModule(ChumBucketHider()) - loadModule(CityProjectFeatures()) - loadModule(ColdOverlay()) + loadModule(ChumBucketHider) + loadModule(CityProjectFeatures) + loadModule(ColdOverlay) loadModule(CollectionTracker) - loadModule(CompactBestiaryChatMessage()) - loadModule(CompactBingoChat()) - loadModule(CompactSplashPotionMessage()) - loadModule(ComposterDisplay()) - loadModule(ComposterInventoryNumbers()) + loadModule(CompactBestiaryChatMessage) + loadModule(CompactBingoChat) + loadModule(CompactSplashPotionMessage) + loadModule(ComposterDisplay) + loadModule(ComposterInventoryNumbers) loadModule(ComposterOverlay) - loadModule(CorpseAPI()) - loadModule(CosmeticFollowingLine()) - loadModule(CraftMaterialsFromBazaar()) + loadModule(CorpseAPI) + loadModule(CosmeticFollowingLine) + loadModule(CraftMaterialsFromBazaar) loadModule(CrimsonIsleReputationHelper(this)) - loadModule(CroesusChestTracker()) + loadModule(CroesusChestTracker) loadModule(CropMoneyDisplay) - loadModule(CropSpeedMeter()) + loadModule(CropSpeedMeter) loadModule(CruxTalismanDisplay) - loadModule(CrystalHollowsNamesInCore()) - loadModule(CrystalHollowsWalls()) - loadModule(CurrentPetDisplay()) + loadModule(CrystalHollowsNamesInCore) + loadModule(CrystalHollowsWalls) + loadModule(CurrentPetDisplay) loadModule(CustomScoreboard()) - loadModule(CustomTextBox()) - loadModule(DamageIndicatorManager()) + loadModule(CustomTextBox) + loadModule(DamageIndicatorManager) loadModule(DanceRoomHelper) loadModule(DianaProfitTracker) loadModule(DicerRngDropTracker) loadModule(DiscordRPCManager) - loadModule(DojoRankDisplay()) - loadModule(DungeonArchitectFeatures()) - loadModule(DungeonBossHideDamageSplash()) - loadModule(DungeonBossMessages()) - loadModule(DungeonChatFilter()) - loadModule(DungeonCleanEnd()) - loadModule(DungeonCopilot()) - loadModule(DungeonDeathCounter()) - loadModule(DungeonFinderFeatures()) - loadModule(DungeonHideItems()) + loadModule(DojoRankDisplay) + loadModule(DungeonArchitectFeatures) + loadModule(DungeonBossHideDamageSplash) + loadModule(DungeonBossMessages) + loadModule(DungeonChatFilter) + loadModule(DungeonCleanEnd) + loadModule(DungeonCopilot) + loadModule(DungeonDeathCounter) + loadModule(DungeonFinderFeatures) + loadModule(DungeonHideItems) loadModule(DungeonHighlightClickedBlocks) loadModule(DungeonLividFinder) loadModule(DungeonMilestonesDisplay) - loadModule(DungeonRankTabListColor()) - loadModule(DungeonShadowAssassinNotification()) - loadModule(DungeonTeammateOutlines()) - loadModule(EasterEggWaypoints()) + loadModule(DungeonRankTabListColor) + loadModule(DungeonShadowAssassinNotification) + loadModule(DungeonTeammateOutlines) + loadModule(EasterEggWaypoints) loadModule(EnchantParser) loadModule(EnderNodeTracker) - loadModule(EndermanSlayerFeatures()) - loadModule(EndermanSlayerHideParticles()) + loadModule(EndermanSlayerFeatures) + loadModule(EndermanSlayerHideParticles) loadModule(EnigmaSoulWaypoints) loadModule(EstimatedItemValue) - loadModule(EstimatedWardrobePrice()) - loadModule(ExcavatorProfitTracker()) - loadModule(ExpOrbsOnGroundHider()) + loadModule(EstimatedWardrobePrice) + loadModule(ExcavatorProfitTracker) + loadModule(ExpOrbsOnGroundHider) loadModule(FarmingFortuneDisplay) loadModule(FarmingLaneAPI) loadModule(FarmingLaneCreator) loadModule(FarmingLaneFeatures) - loadModule(FarmingWeightDisplay()) - loadModule(FerocityDisplay()) - loadModule(FirePillarDisplay()) - loadModule(FireVeilWandParticles()) - loadModule(FishingBaitWarnings()) - loadModule(FishingHookDisplay()) + loadModule(FarmingWeightDisplay) + loadModule(FerocityDisplay) + loadModule(FirePillarDisplay) + loadModule(FireVeilWandParticles) + loadModule(FishingBaitWarnings) + loadModule(FishingHookDisplay) loadModule(FishingProfitTracker) - loadModule(FishingTimer()) - loadModule(FixNEUHeavyPearls()) + loadModule(FishingTimer) + loadModule(FixNEUHeavyPearls) loadModule(FossilSolverDisplay) loadModule(FrozenTreasureTracker) - loadModule(GardenBurrowingSporesNotifier()) - loadModule(GardenComposterInventoryFeatures()) + loadModule(GardenBurrowingSporesNotifier) + loadModule(GardenComposterInventoryFeatures) loadModule(GardenCropMilestoneDisplay) - loadModule(GardenCropMilestoneFix()) + loadModule(GardenCropMilestoneFix) loadModule(GardenCustomKeybinds) - loadModule(GardenInventoryNumbers()) - loadModule(GardenInventoryTooltipOverflow()) - loadModule(GardenLevelDisplay()) + loadModule(GardenInventoryNumbers) + loadModule(GardenInventoryTooltipOverflow) + loadModule(GardenLevelDisplay) loadModule(GardenNextJacobContest) - loadModule(GardenNextPlotPrice()) - loadModule(GardenOptimalSpeed()) + loadModule(GardenNextPlotPrice) + loadModule(GardenOptimalSpeed) loadModule(GardenPlotBorders) loadModule(GardenPlotIcon) - loadModule(GardenPlotMenuHighlighting()) + loadModule(GardenPlotMenuHighlighting) loadModule(GardenStartLocation) loadModule(GardenVisitorColorNames) loadModule(GardenVisitorDropStatistics) loadModule(GardenVisitorFeatures) - loadModule(GardenVisitorSupercraft()) - loadModule(GardenVisitorTimer()) - loadModule(GardenYawAndPitch()) + loadModule(GardenVisitorSupercraft) + loadModule(GardenVisitorTimer) + loadModule(GardenYawAndPitch) loadModule(GetFromSacksTabComplete) - loadModule(GeyserFishing()) + loadModule(GeyserFishing) loadModule(GhostCounter) - loadModule(GlacitePowderFeatures()) - loadModule(GlowingDroppedItems()) - loadModule(GoldenGoblinHighlight()) + loadModule(GlacitePowderFeatures) + loadModule(GlowingDroppedItems) + loadModule(GoldenGoblinHighlight) loadModule(GriffinBurrowHelper) loadModule(GriffinBurrowParticleFinder) - loadModule(GriffinPetWarning()) + loadModule(GriffinPetWarning) loadModule(HarpFeatures) loadModule(HellionShieldHelper) - loadModule(HideArmor()) - loadModule(HideDamageSplash()) - loadModule(HideFarEntities()) - loadModule(HideMobNames()) - loadModule(HideNotClickableItems()) - loadModule(HighlightBonzoMasks()) - loadModule(HighlightDungeonDeathmite()) - loadModule(HighlightInquisitors()) - loadModule(HighlightJerries()) - loadModule(HighlightMiningCommissionMobs()) - loadModule(HighlightPlaceableNpcs()) - loadModule(HighlightRiftGuide()) + loadModule(HideArmor) + loadModule(HideDamageSplash) + loadModule(HideFarEntities) + loadModule(HideMobNames) + loadModule(HideNotClickableItems) + loadModule(HighlightBonzoMasks) + loadModule(HighlightDungeonDeathmite) + loadModule(HighlightInquisitors) + loadModule(HighlightJerries) + loadModule(HighlightMiningCommissionMobs) + loadModule(HighlightPlaceableNpcs) + loadModule(HighlightRiftGuide) loadModule(HoppityCollectionStats) loadModule(HoppityEggDisplayManager) loadModule(HoppityEggLocator) loadModule(HoppityEggsManager) loadModule(HoppityEggsShared) loadModule(HoppityNpc) - loadModule(InGameDateDisplay()) - loadModule(InfernoMinionFeatures()) + loadModule(InGameDateDisplay) + loadModule(InfernoMinionFeatures) loadModule(InquisitorWaypointShare) - loadModule(ItemAbilityCooldown()) + loadModule(ItemAbilityCooldown) loadModule(ItemDisplayOverlayFeatures) - loadModule(ItemStars()) - loadModule(JacobContestFFNeededDisplay()) - loadModule(JacobContestStatsSummary()) - loadModule(JacobContestTimeNeeded()) - loadModule(JacobFarmingContestsInventory()) - loadModule(JerryIslandTimer()) - loadModule(JoinCrystalHollows()) - loadModule(JyrreTimer()) + loadModule(ItemStars) + loadModule(JacobContestFFNeededDisplay) + loadModule(JacobContestStatsSummary) + loadModule(JacobContestTimeNeeded) + loadModule(JacobFarmingContestsInventory) + loadModule(JerryIslandTimer) + loadModule(JoinCrystalHollows) + loadModule(JyrreTimer) loadModule(KingTalismanHelper) - loadModule(KloonHacking()) - loadModule(LesserOrbHider()) - loadModule(LimboPlaytime()) + loadModule(KloonHacking) + loadModule(LesserOrbHider) + loadModule(LimboPlaytime) loadModule(LimboTimeTracker) - loadModule(LivingCaveDefenseBlocks()) - loadModule(LivingCaveLivingMetalHelper()) - loadModule(LivingMetalSuitProgress()) + loadModule(LivingCaveDefenseBlocks) + loadModule(LivingCaveLivingMetalHelper) + loadModule(LivingMetalSuitProgress) loadModule(LockMouseLook) - loadModule(LogBookStats()) - loadModule(MarkedPlayerManager()) - loadModule(MatriarchHelper()) - loadModule(MaxPurseItems()) - loadModule(MineshaftCorpseProfitPer()) + loadModule(LogBookStats) + loadModule(MarkedPlayerManager) + loadModule(MatriarchHelper) + loadModule(MaxPurseItems) + loadModule(MineshaftCorpseProfitPer) loadModule(MiningCommissionsBlocksColor) loadModule(MiningEventDisplay) - loadModule(MiningEventTracker()) + loadModule(MiningEventTracker) loadModule(MiningNotifications) - loadModule(MinionCollectLogic()) - loadModule(MinionCraftHelper()) - loadModule(MinionFeatures()) - loadModule(MinionXp()) - loadModule(MiscFeatures()) - loadModule(MobHighlight()) + loadModule(MinionCollectLogic) + loadModule(MinionCraftHelper) + loadModule(MinionFeatures) + loadModule(MinionXp) + loadModule(MiscFeatures) + loadModule(MobHighlight) loadModule(ModifyVisualWords) - loadModule(MovementSpeedDisplay()) + loadModule(MovementSpeedDisplay) loadModule(MythologicalCreatureTracker) loadModule(NPCVisitorFix) - loadModule(NewYearCakeReminder()) + loadModule(NewYearCakeReminder) loadModule(NoBitsWarning) - loadModule(NonGodPotEffectDisplay()) - loadModule(OdgerWaypoint()) - loadModule(PabloHelper()) - loadModule(ParticleHider()) + loadModule(NonGodPotEffectDisplay) + loadModule(OdgerWaypoint) + loadModule(PabloHelper) + loadModule(ParticleHider) loadModule(PartyChatCommands) loadModule(PartyCommands) - loadModule(PartyMemberOutlines()) - loadModule(PatcherSendCoordinates()) - loadModule(PestFinder()) - loadModule(PestParticleLine()) - loadModule(PestParticleWaypoint()) + loadModule(PartyMemberOutlines) + loadModule(PatcherSendCoordinates) + loadModule(PestFinder) + loadModule(PestParticleLine) + loadModule(PestParticleWaypoint) loadModule(PestProfitTracker) - loadModule(PestSpawn()) + loadModule(PestSpawn) loadModule(PestSpawnTimer) - loadModule(PetCandyUsedDisplay()) - loadModule(PetExpTooltip()) - loadModule(PetItemDisplay()) - loadModule(PlayerChatFilter()) - loadModule(PlayerChatModifier()) - loadModule(PlayerDeathMessages()) + loadModule(PetCandyUsedDisplay) + loadModule(PetExpTooltip) + loadModule(PetItemDisplay) + loadModule(PlayerChatFilter) + loadModule(PlayerChatModifier) + loadModule(PlayerDeathMessages) loadModule(PlayerTabComplete) - loadModule(PocketSackInASackDisplay()) + loadModule(PocketSackInASackDisplay) loadModule(PowderTracker) - loadModule(PowerStoneGuideFeatures()) - loadModule(PresentWaypoints()) - loadModule(PrivateIslandNoPickaxeAbility()) - loadModule(ProfitPerExcavation()) - loadModule(QuickCraftFeatures()) + loadModule(PowerStoneGuideFeatures) + loadModule(PresentWaypoints) + loadModule(PrivateIslandNoPickaxeAbility) + loadModule(ProfitPerExcavation) + loadModule(QuickCraftFeatures) loadModule(QuickModMenuSwitch) - loadModule(QuiverDisplay()) - loadModule(QuiverWarning()) - loadModule(RareDropMessages()) - loadModule(ReplaceRomanNumerals()) + loadModule(QuiverDisplay) + loadModule(QuiverWarning) + loadModule(RareDropMessages) + loadModule(ReplaceRomanNumerals) loadModule(RepoPatternManager) - loadModule(RestorePieceOfWizardPortalLore()) - loadModule(RiftAgaricusCap()) + loadModule(RestorePieceOfWizardPortalLore) + loadModule(RiftAgaricusCap) loadModule(RiftBloodEffigies) - loadModule(RiftHorsezookaHider()) - loadModule(RiftLarva()) - loadModule(RiftLavaMazeParkour()) - loadModule(RiftMotesOrb()) - loadModule(RiftOdonata()) - loadModule(RiftTimer()) - loadModule(RiftUpsideDownParkour()) - loadModule(RiftWiltedBerberisHelper()) - loadModule(RngMeterInventory()) + loadModule(RiftHorsezookaHider) + loadModule(RiftLarva) + loadModule(RiftLavaMazeParkour) + loadModule(RiftMotesOrb) + loadModule(RiftOdonata) + loadModule(RiftTimer) + loadModule(RiftUpsideDownParkour) + loadModule(RiftWiltedBerberisHelper) + loadModule(RngMeterInventory) loadModule(SackDisplay) - loadModule(SeaCreatureMessageShortener()) + loadModule(SeaCreatureMessageShortener) loadModule(SeaCreatureTracker) - loadModule(SendCoordinatedCommand()) + loadModule(SendCoordinatedCommand) loadModule(SensitivityReducer) loadModule(ServerRestartTitle) - loadModule(SharkFishCounter()) - loadModule(ShiftClickBrewing()) - loadModule(ShiftClickEquipment()) + loadModule(SharkFishCounter) + loadModule(ShiftClickBrewing) + loadModule(ShiftClickEquipment) loadModule(ShiftClickNPCSell) - loadModule(ShowFishingItemName()) - loadModule(ShowItemUuid()) - loadModule(ShowMotesNpcSellPrice()) + loadModule(ShowFishingItemName) + loadModule(ShowItemUuid) + loadModule(ShowMotesNpcSellPrice) loadModule(ShyCruxWarnings) loadModule(SkillProgress) - loadModule(SkillTooltip()) - loadModule(SkyBlockKickDuration()) - loadModule(SkyMartCopperPrice()) + loadModule(SkillTooltip) + loadModule(SkyBlockKickDuration) + loadModule(SkyMartCopperPrice) loadModule(SkyblockGuideHighlightFeature) - loadModule(SkyblockXPInChat()) - loadModule(SlayerBossSpawnSoon()) - loadModule(SlayerItemsOnGround()) - loadModule(SlayerMiniBossFeatures()) + loadModule(SkyblockXPInChat) + loadModule(SlayerBossSpawnSoon) + loadModule(SlayerItemsOnGround) + loadModule(SlayerMiniBossFeatures) loadModule(SlayerProfitTracker) - loadModule(SlayerQuestWarning()) - loadModule(SlayerRngMeterDisplay()) - loadModule(SoopyGuessBurrow()) - loadModule(SpawnTimers()) - loadModule(SprayDisplay()) - loadModule(SprayFeatures()) - loadModule(StatsTuning()) - loadModule(StereoHarmonyDisplay()) - loadModule(SulphurSkitterBox()) - loadModule(SummoningMobManager()) - loadModule(SummoningSoulsName()) + loadModule(SlayerQuestWarning) + loadModule(SlayerRngMeterDisplay) + loadModule(SoopyGuessBurrow) + loadModule(SpawnTimers) + loadModule(SprayDisplay) + loadModule(SprayFeatures) + loadModule(StatsTuning) + loadModule(StereoHarmonyDisplay) + loadModule(SulphurSkitterBox) + loadModule(SummoningMobManager) + loadModule(SummoningSoulsName) loadModule(SuperCraftFeatures) - loadModule(SuperpairsClicksAlert()) + loadModule(SuperpairsClicksAlert) loadModule(TabListReader) loadModule(TabListRenderer) - loadModule(TabWidgetSettings()) - loadModule(TeleportPadCompactName()) - loadModule(TeleportPadInventoryNumber()) - loadModule(TerracottaPhase()) - loadModule(TheGreatSpook()) - loadModule(ThunderSparksHighlight()) - loadModule(TiaRelayHelper()) - loadModule(TiaRelayWaypoints()) - loadModule(ToolTooltipTweaks()) - loadModule(TotemOfCorruption()) - loadModule(TpsCounter()) - loadModule(Translator()) + loadModule(TabWidgetSettings) + loadModule(TeleportPadCompactName) + loadModule(TeleportPadInventoryNumber) + loadModule(TerracottaPhase) + loadModule(TheGreatSpook) + loadModule(ThunderSparksHighlight) + loadModule(TiaRelayHelper) + loadModule(TiaRelayWaypoints) + loadModule(ToolTooltipTweaks) + loadModule(TotemOfCorruption) + loadModule(TpsCounter) + loadModule(Translator) loadModule(TrevorFeatures) loadModule(TrevorSolver) loadModule(TrevorTracker) - loadModule(TrophyFishFillet()) + loadModule(TrophyFishFillet) loadModule(TrophyFishManager) - loadModule(TrophyFishMessages()) - loadModule(TubulatorParkour()) - loadModule(TunnelsMaps()) + loadModule(TrophyFishMessages) + loadModule(TubulatorParkour) + loadModule(TunnelsMaps) loadModule(UniqueGiftCounter) loadModule(UniqueGiftingOpportunitiesFeatures) loadModule(VampireSlayerFeatures) - loadModule(VerminHighlighter()) + loadModule(VerminHighlighter) loadModule(VerminTracker) loadModule(ViewRecipeCommand) - loadModule(VolcanoExplosivityDisplay()) + loadModule(VolcanoExplosivityDisplay) loadModule(VoltHighlighter) - loadModule(WarpIsCommand()) + loadModule(WarpIsCommand) loadModule(WarpTabComplete) - loadModule(WatchdogHider()) + loadModule(WatchdogHider) loadModule(WikiManager) - loadModule(WildStrawberryDyeNotification()) - loadModule(WrongFungiCutterWarning()) + loadModule(WildStrawberryDyeNotification) + loadModule(WrongFungiCutterWarning) // test stuff - loadModule(ButtonOnPause()) + loadModule(ButtonOnPause) loadModule(FixGhostEntities) - loadModule(HighlightMissingRepoItems()) + loadModule(HighlightMissingRepoItems) loadModule(PacketTest) - loadModule(ParkourWaypointSaver()) + loadModule(ParkourWaypointSaver) loadModule(SkyHanniDebugsAndTests()) loadModule(TestBingo) loadModule(TestCopyBestiaryValues) loadModule(TestCopyRngMeterValues) - loadModule(TestShowSlotNumber()) + loadModule(TestShowSlotNumber) loadModule(TrackParticlesCommand) loadModule(TrackSoundsCommand) loadModule(WorldEdit) - loadModule(MobDebug()) + loadModule(MobDebug) init() PreInitFinishedEvent().postAndCatch() } diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 50a579c526d6..7101a8d1463f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -312,7 +312,7 @@ object Commands { registerCommand( "shlimbo", "Warps you to Limbo." - ) { MiscFeatures().goToLimbo() } + ) { MiscFeatures.goToLimbo() } registerCommand( "shlanedetection", "Detect a farming lane in garden" diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt index 101489a85327..0c6881a73d3d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt @@ -20,9 +20,9 @@ package at.hannibal2.skyhanni.config.core.config.gui import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.data.GuiEditManager -import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsX -import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY -import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getDummySize +import at.hannibal2.skyhanni.data.GuiEditManager.getAbsX +import at.hannibal2.skyhanni.data.GuiEditManager.getAbsY +import at.hannibal2.skyhanni.data.GuiEditManager.getDummySize import at.hannibal2.skyhanni.data.OtherInventoryData import at.hannibal2.skyhanni.mixins.transformers.gui.AccessorGuiContainer import at.hannibal2.skyhanni.utils.GuiRenderUtils diff --git a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java index 514cea176e7e..3183779145a7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java @@ -502,7 +502,7 @@ public static class DungeonStorage { public Map bosses = new HashMap<>(); @Expose - public List runs = CroesusChestTracker.Companion.generateMaxChestAsList(); + public List runs = CroesusChestTracker.generateMaxChestAsList(); public static class DungeonRunInfo { diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt index 97039022ace9..17bf953c9875 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt @@ -15,16 +15,18 @@ import net.minecraft.client.Minecraft import net.minecraft.entity.Entity import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class EntityMovementData { +object EntityMovementData { - companion object { + private val warpingPattern by RepoPattern.pattern( + "data.entity.warping", + "§7(?:Warping|Warping you to your SkyBlock island|Warping using transfer token|Finding player|Sending a visit request)\\.\\.\\." + ) - private val entityLocation = mutableMapOf() + private val entityLocation = mutableMapOf() - fun addToTrack(entity: Entity) { - if (entity !in entityLocation) { - entityLocation[entity] = entity.getLorenzVec() - } + fun addToTrack(entity: Entity) { + if (entity !in entityLocation) { + entityLocation[entity] = entity.getLorenzVec() } } @@ -46,15 +48,6 @@ class EntityMovementData { } } - private val warpingPattern by RepoPattern.pattern( - "warping", - "§7Warping...|" + - "§7Warping you to your SkyBlock island...|" + - "§7Warping using transfer token...|" + - "§7Finding player...|" + - "§7Sending a visit request..." - ) - @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return diff --git a/src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt b/src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt index f48146411472..25bc6ef3d900 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.mc.McClient import kotlin.concurrent.fixedRateTimer -class FixedRateTimerManager { +object FixedRateTimerManager { private var totalSeconds = 0 init { diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenComposterUpgradesData.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenComposterUpgradesData.kt index 64eac452b618..30424e6544d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenComposterUpgradesData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenComposterUpgradesData.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GardenComposterUpgradesData { +object GardenComposterUpgradesData { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt index e6c810852db6..5a131ae79bbc 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt @@ -1,52 +1,60 @@ package at.hannibal2.skyhanni.data -import at.hannibal2.skyhanni.events.CropUpgradeUpdateEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.garden.CropType -import at.hannibal2.skyhanni.features.garden.CropType.Companion.getByNameOrNull import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.NumberUtil.formatInt +import at.hannibal2.skyhanni.utils.StringUtils.matchFirst +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GardenCropUpgrades { +object GardenCropUpgrades { - // TODO USE SH-REPO - private val tierPattern = "§7Current Tier: §[0-9a-e](\\d)§7/§a9".toRegex() - private val chatUpgradePattern = " {2}§r§6§lCROP UPGRADE §e§f([\\w ]+)§7 #(\\d)".toRegex() + private val patternGroup = RepoPattern.group("garden.cropupgrades") + private val tierPattern by patternGroup.pattern( + "tier", + "§7Current Tier: §.(?\\d)§7/§a9" + ) + private val chatUpgradePattern by patternGroup.pattern( + "chatupgrade", + "\\s+§r§6§lCROP UPGRADE §e(?[\\w ]+)§7 #(?\\d)" + ) + + private val cropUpgrades: MutableMap? get() = GardenAPI.storage?.cropUpgrades @SubscribeEvent fun onChat(event: LorenzChatEvent) { - chatUpgradePattern.matchEntire(event.message)?.groups?.let { matches -> - val crop = getByNameOrNull(matches[1]!!.value) ?: return - val level = matches[2]!!.value.toInt() - crop.setUpgradeLevel(level) + if (!GardenAPI.inGarden()) return + + chatUpgradePattern.matchMatcher(event.message) { + val crop = CropType.getByNameOrNull(group("crop")) + val level = group("tier").formatInt() + crop?.setUpgradeLevel(level) } - CropUpgradeUpdateEvent().postAndCatch() } @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { + if (!GardenAPI.inGarden()) return if (event.inventoryName != "Crop Upgrades") return - event.inventoryItems.forEach { (_, item) -> - val crop = CropType.getByNameOrNull(item.name.removeColor()) ?: return@forEach - val level = item.getLore() - .firstNotNullOfOrNull { tierPattern.matchEntire(it)?.groups?.get(1)?.value?.toIntOrNull() } ?: 0 - crop.setUpgradeLevel(level) + + for (item in event.inventoryItems.values) { + val crop = CropType.getByNameOrNull(item.name.removeColor()) ?: continue + item.getLore().matchFirst(tierPattern) { + val level = group("level").formatInt() + crop.setUpgradeLevel(level) + } } - CropUpgradeUpdateEvent().postAndCatch() } - companion object { + fun CropType.getUpgradeLevel() = cropUpgrades?.get(this) - private val cropUpgrades: MutableMap? get() = GardenAPI.storage?.cropUpgrades - - fun CropType.getUpgradeLevel() = cropUpgrades?.get(this) - - fun CropType.setUpgradeLevel(level: Int) { - cropUpgrades?.put(this, level) - } + private fun CropType.setUpgradeLevel(level: Int) { + cropUpgrades?.put(this, level) } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index af68cd84733e..acf281b2e646 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -30,10 +30,14 @@ import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds -class GuiEditManager { +object GuiEditManager { private var lastHotkeyPressed = SimpleTimeMark.farPast() + private var currentPositions = TimeLimitedCache(15.seconds) + private var currentBorderSize = mutableMapOf>() + private var lastMovedGui: String? = null + @SubscribeEvent fun onKeyClick(event: LorenzKeyPressEvent) { if (event.keyCode != SkyHanniMod.feature.gui.keyBindOpen) return @@ -66,77 +70,70 @@ class GuiEditManager { } } - companion object { - - private var currentPositions = TimeLimitedCache(15.seconds) - private var currentBorderSize = mutableMapOf>() - private var lastMovedGui: String? = null - - @JvmStatic - fun add(position: Position, posLabel: String, x: Int, y: Int) { - var name = position.internalName - if (name == null) { - name = if (posLabel == "none") "none " + UUID.randomUUID() else posLabel - position.internalName = name - } - currentPositions.put(name, position) - currentBorderSize[posLabel] = Pair(x, y) + @JvmStatic + fun add(position: Position, posLabel: String, x: Int, y: Int) { + var name = position.internalName + if (name == null) { + name = if (posLabel == "none") "none " + UUID.randomUUID() else posLabel + position.internalName = name } + currentPositions.put(name, position) + currentBorderSize[posLabel] = Pair(x, y) + } - private var lastHotkeyReminded = SimpleTimeMark.farPast() - - @JvmStatic - fun openGuiPositionEditor(hotkeyReminder: Boolean) { - SkyHanniMod.screenToOpen = GuiPositionEditor( - currentPositions.values().toList(), - 2, - Minecraft.getMinecraft().currentScreen as? GuiContainer + private var lastHotkeyReminded = SimpleTimeMark.farPast() + + @JvmStatic + fun openGuiPositionEditor(hotkeyReminder: Boolean) { + SkyHanniMod.screenToOpen = GuiPositionEditor( + currentPositions.values().toList(), + 2, + Minecraft.getMinecraft().currentScreen as? GuiContainer + ) + if (hotkeyReminder && lastHotkeyReminded.passedSince() > 30.minutes) { + lastHotkeyReminded = SimpleTimeMark.now() + ChatUtils.chat( + "§eTo edit hidden GUI elements:\n" + + " §7- §e1. Set a key in /sh edit.\n" + + " §7- §e2. Click that key while the GUI element is visible." ) - if (hotkeyReminder && lastHotkeyReminded.passedSince() > 30.minutes) { - lastHotkeyReminded = SimpleTimeMark.now() - ChatUtils.chat( - "§eTo edit hidden GUI elements:\n" + - " §7- §e1. Set a key in /sh edit.\n" + - " §7- §e2. Click that key while the GUI element is visible." - ) - } } + } - @JvmStatic - fun renderLast() { - if (!isInGui()) return - if (!SkyHanniDebugsAndTests.globalRender) return + @JvmStatic + fun renderLast() { + if (!isInGui()) return + if (!SkyHanniDebugsAndTests.globalRender) return - GlStateManager.translate(0f, 0f, 200f) + GlStateManager.translate(0f, 0f, 200f) - GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch() + GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch() - GlStateManager.pushMatrix() - GlStateManager.enableDepth() - GuiRenderEvent.ChestGuiOverlayRenderEvent().postAndCatch() - GlStateManager.popMatrix() + GlStateManager.pushMatrix() + GlStateManager.enableDepth() + GuiRenderEvent.ChestGuiOverlayRenderEvent().postAndCatch() + GlStateManager.popMatrix() - GlStateManager.translate(0f, 0f, -200f) - } + GlStateManager.translate(0f, 0f, -200f) + } - fun isInGui() = Minecraft.getMinecraft().currentScreen is GuiPositionEditor + fun isInGui() = Minecraft.getMinecraft().currentScreen is GuiPositionEditor - fun Position.getDummySize(random: Boolean = false): Vector2i { - if (random) return Vector2i(5, 5) - val (x, y) = currentBorderSize[internalName] ?: return Vector2i(1, 1) - return Vector2i((x * effectiveScale).toInt(), (y * effectiveScale).toInt()) - } + fun Position.getDummySize(random: Boolean = false): Vector2i { + if (random) return Vector2i(5, 5) + val (x, y) = currentBorderSize[internalName] ?: return Vector2i(1, 1) + return Vector2i((x * effectiveScale).toInt(), (y * effectiveScale).toInt()) + } - fun Position.getAbsX() = getAbsX0(getDummySize(true).x) + fun Position.getAbsX() = getAbsX0(getDummySize(true).x) - fun Position.getAbsY() = getAbsY0(getDummySize(true).y) + fun Position.getAbsY() = getAbsY0(getDummySize(true).y) - fun GuiProfileViewer.anyTextBoxFocused() = - this.getPropertiesWithType().any { it.focus } + fun GuiProfileViewer.anyTextBoxFocused() = + this.getPropertiesWithType().any { it.focus } - fun handleGuiPositionMoved(guiName: String) { - lastMovedGui = guiName - } + fun handleGuiPositionMoved(guiName: String) { + lastMovedGui = guiName } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt index 2e6ff68962e1..d4dec39c2499 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt @@ -19,12 +19,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds -class ItemAddManager { - enum class Source { - ITEM_ADD, - SACKS, - ; - } +object ItemAddManager { + private var lastDiceRoll = SimpleTimeMark.farPast() + private var superCraftedItems = TimeLimitedSet(30.seconds) private val diceRollChatPattern by RepoPattern.pattern( "data.itemmanager.diceroll", @@ -83,9 +80,6 @@ class ItemAddManager { ItemAddEvent(internalName, amount, this).postAndCatch() } - private var lastDiceRoll = SimpleTimeMark.farPast() - private var superCraftedItems = TimeLimitedSet(30.seconds) - @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (diceRollChatPattern.matches(event.message)) { @@ -97,4 +91,10 @@ class ItemAddManager { superCraftedItems.add(internalName) } } + + enum class Source { + ITEM_ADD, + SACKS, + ; + } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt index 705eae9e21a8..d8d1b5720fe2 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt @@ -13,7 +13,7 @@ import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement import net.minecraft.network.play.client.C0APacketAnimation import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ItemClickData { +object ItemClickData { @SubscribeEvent fun onItemClickSend(event: PacketEvent.SendEvent) { @@ -57,26 +57,4 @@ class ItemClickData { } } } - - /* @SubscribeEvent - fun onEntityClick(event: InputEvent) { - if (!LorenzUtils.inSkyBlock) return - - val minecraft = Minecraft.getMinecraft() - - val attackKey = minecraft.gameSettings.keyBindAttack - val useKey = minecraft.gameSettings.keyBindUseItem - - val clickType = when { - attackKey.isKeyDown -> ClickType.LEFT_CLICK - useKey.isKeyDown -> ClickType.RIGHT_CLICK - else -> return - } - - val clickedEntity = minecraft.pointedEntity - if (minecraft.thePlayer == null) return - if (clickedEntity == null) return - - EntityClickEvent(clickType, clickedEntity, InventoryUtils.getItemInHand()).postAndCatch() - } */ } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt index 22d299f17e62..141bf3ceae1c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt @@ -16,7 +16,7 @@ import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ItemTipHelper { +object ItemTipHelper { @SubscribeEvent fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) { @@ -75,4 +75,4 @@ class ItemTipHelper { GlStateManager.enableLighting() GlStateManager.enableDepth() } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt index b10792424942..960cb7b12052 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt @@ -28,7 +28,7 @@ import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds -class OwnInventoryData { +object OwnInventoryData { private var itemAmounts = mapOf() private var dirty = false diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt index f8e8f37dae27..82e9e9ac44dc 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt @@ -16,7 +16,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class RenderData { +object RenderData { @SubscribeEvent fun onRenderOverlay(event: RenderGameOverlayEvent.Pre) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt index 72bc96988101..2fc4aee30ed0 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt @@ -12,64 +12,61 @@ import net.minecraft.scoreboard.ScorePlayerTeam import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ScoreboardData { - - companion object { - - private val minecraftColorCodesPattern = "(?i)[0-9a-fkmolnr]".toPattern() - - // TODO USE SH-REPO - private val splitIcons = listOf( - "\uD83C\uDF6B", - "\uD83D\uDCA3", - "\uD83D\uDC7D", - "\uD83D\uDD2E", - "\uD83D\uDC0D", - "\uD83D\uDC7E", - "\uD83C\uDF20", - "\uD83C\uDF6D", - "⚽", - "\uD83C\uDFC0", - "\uD83D\uDC79", - "\uD83C\uDF81", - "\uD83C\uDF89", - "\uD83C\uDF82", - "\uD83D\uDD2B", - ) - - fun formatLines(rawList: List): List { - val list = mutableListOf() - for (line in rawList) { - val separator = splitIcons.find { line.contains(it) } ?: continue - val split = line.split(separator) - val start = split[0] - var end = split[1] - // get last color code in start - val lastColorIndex = start.lastIndexOf('§') - val lastColor = if (lastColorIndex != -1 - && lastColorIndex + 1 < start.length - && (minecraftColorCodesPattern.matches(start[lastColorIndex + 1].toString())) - ) start.substring(lastColorIndex, lastColorIndex + 2) - else "" - - // remove first color code from end, when it is the same as the last color code in start - end = end.removePrefix(lastColor) - - list.add(start + end) - } - - return list - } +object ScoreboardData { - var sidebarLinesFormatted: List = emptyList() + private val minecraftColorCodesPattern = "(?i)[0-9a-fkmolnr]".toPattern() - var sidebarLines: List = emptyList() // TODO rename to raw - var sidebarLinesRaw: List = emptyList() // TODO delete - var objectiveTitle = "" - } + var sidebarLinesFormatted: List = emptyList() + + private var sidebarLines: List = emptyList() // TODO rename to raw + var sidebarLinesRaw: List = emptyList() // TODO delete + var objectiveTitle = "" var dirty = false + // TODO USE SH-REPO + private val splitIcons = listOf( + "\uD83C\uDF6B", + "\uD83D\uDCA3", + "\uD83D\uDC7D", + "\uD83D\uDD2E", + "\uD83D\uDC0D", + "\uD83D\uDC7E", + "\uD83C\uDF20", + "\uD83C\uDF6D", + "⚽", + "\uD83C\uDFC0", + "\uD83D\uDC79", + "\uD83C\uDF81", + "\uD83C\uDF89", + "\uD83C\uDF82", + "\uD83D\uDD2B", + ) + + fun formatLines(rawList: List): List { + val list = mutableListOf() + for (line in rawList) { + val separator = splitIcons.find { line.contains(it) } ?: continue + val split = line.split(separator) + val start = split[0] + var end = split[1] + // get last color code in start + val lastColorIndex = start.lastIndexOf('§') + val lastColor = if (lastColorIndex != -1 + && lastColorIndex + 1 < start.length + && (minecraftColorCodesPattern.matches(start[lastColorIndex + 1].toString())) + ) start.substring(lastColorIndex, lastColorIndex + 2) + else "" + + // remove first color code from end, when it is the same as the last color code in start + end = end.removePrefix(lastColor) + + list.add(start + end) + } + + return list + } + @SubscribeEvent(receiveCanceled = true) fun onPacketReceive(event: PacketEvent.ReceiveEvent) { if (event.packet is S3BPacketScoreboardObjective) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/item/SkyhanniItems.kt b/src/main/java/at/hannibal2/skyhanni/data/item/SkyhanniItems.kt index 6d62a190e893..bc30ccd21552 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/item/SkyhanniItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/item/SkyhanniItems.kt @@ -92,6 +92,7 @@ enum class SkyhanniItems(private var id: String? = null, private var tier: Int? NEW_BOTTLE_OF_JYRRE, NEW_YEAR_CAKE, NONE, + OIL_BARREL, ORANGE_STAINED_GLASS("STAINED_GLASS-1"), PAPER, PEST_BEETLE_MONSTER, @@ -159,6 +160,7 @@ enum class SkyhanniItems(private var id: String? = null, private var tier: Int? VOIDLING_GENERATOR_1, VOLTA, VOODOO_DOLL_WILTED, + WATCH, WEIRDER_TUBA, WEIRD_TUBA, WHEAT, @@ -171,8 +173,6 @@ enum class SkyhanniItems(private var id: String? = null, private var tier: Int? ZOMBIE_SOLDIER_CUTLASS, ; - // TODO make it work with items with a dash in their name - private val baseItem by lazy { (id ?: name).asInternalName() } operator fun invoke() = baseItem diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt index f886cb0cb7e0..35e590c14f62 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDebug.kt @@ -14,7 +14,7 @@ import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityPlayerSP import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class MobDebug { +object MobDebug { private val config get() = SkyHanniMod.feature.dev.mobDebug.mobDetection diff --git a/src/main/java/at/hannibal2/skyhanni/events/CropUpgradeUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/CropUpgradeUpdateEvent.kt deleted file mode 100644 index 3deccc74c4df..000000000000 --- a/src/main/java/at/hannibal2/skyhanni/events/CropUpgradeUpdateEvent.kt +++ /dev/null @@ -1,3 +0,0 @@ -package at.hannibal2.skyhanni.events - -class CropUpgradeUpdateEvent : LorenzEvent() \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt index 9e9992ab1f7a..2e0a77213b8f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt @@ -13,7 +13,7 @@ import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class AnvilCombineHelper { +object AnvilCombineHelper { @SubscribeEvent fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt index 814de64ef811..efd8181f20c1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class CompactBingoChat { +object CompactBingoChat { private val config get() = SkyHanniMod.feature.event.bingo.compactChat diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index 590b7775e2e1..eb5336ae2a1e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -30,7 +30,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class MinionCraftHelper { +object MinionCraftHelper { private val config get() = SkyHanniMod.feature.event.bingo diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt index 733b412f0f59..5316ffa9251e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt @@ -27,45 +27,41 @@ import net.minecraft.client.gui.inventory.GuiInventory import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.days -class BingoCardDisplay { +object BingoCardDisplay { private var display = emptyList() private var hasHiddenPersonalGoals = false - companion object { + private const val MAX_PERSONAL_GOALS = 20 - private const val MAX_PERSONAL_GOALS = 20 - private const val MAX_COMMUNITY_GOALS = 5 + private val config get() = SkyHanniMod.feature.event.bingo.bingoCard + private var displayMode = 0 - private val config get() = SkyHanniMod.feature.event.bingo.bingoCard - private var displayMode = 0 + fun command() { + reload() + } - fun command() { - reload() - } + private fun reload() { + BingoAPI.bingoGoals.clear() + } - private fun reload() { - BingoAPI.bingoGoals.clear() + fun toggleCommand() { + if (!LorenzUtils.isBingoProfile) { + ChatUtils.userError("This command only works on a bingo profile!") + return } - - fun toggleCommand() { - if (!LorenzUtils.isBingoProfile) { - ChatUtils.userError("This command only works on a bingo profile!") - return - } - if (!config.enabled) { - ChatUtils.userError("Bingo Card is disabled in the config!") - return - } - toggleMode() + if (!config.enabled) { + ChatUtils.userError("Bingo Card is disabled in the config!") + return } + toggleMode() + } - private fun toggleMode() { - displayMode++ - if (displayMode == 3) { - displayMode = 0 - } + private fun toggleMode() { + displayMode++ + if (displayMode == 3) { + displayMode = 0 } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt index 6da74bc5c965..c6324cdd6344 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt @@ -22,7 +22,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration -class BingoCardReader { +object BingoCardReader { private val config get() = SkyHanniMod.feature.event.bingo.bingoCard private val patternGroup = RepoPattern.group("bingo.card") diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt index 067df24b1198..6f903030ec3a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt @@ -17,7 +17,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class BingoCardTips { +object BingoCardTips { private val config get() = SkyHanniMod.feature.event.bingo.bingoCard diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt index 3d2ff4a94ae9..69032ff8137d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt @@ -29,7 +29,7 @@ import at.hannibal2.skyhanni.utils.mc.McPlayer import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class BingoNextStepHelper { +object BingoNextStepHelper { private val config get() = SkyHanniMod.feature.event.bingo.bingoCard private var dirty = true @@ -61,72 +61,69 @@ class BingoNextStepHelper { private val islands = mutableMapOf() private val rhysTaskName = "30x Enchanted Minerals (Redstone, Lapis Lazuli, Coal) (for Rhys)" - companion object { + private val finalSteps = mutableListOf() + private var currentSteps = emptyList() + var currentHelp = emptyList() - private val finalSteps = mutableListOf() - private var currentSteps = emptyList() - var currentHelp = emptyList() - - fun command() { - updateResult(true) - } + fun command() { + updateResult(true) + } - private fun updateResult(print: Boolean = false) { + private fun updateResult(print: Boolean = false) { + if (print) println() + currentSteps = listOf() + for (step in finalSteps) { + printRequirements(step, print) if (print) println() - currentSteps = listOf() - for (step in finalSteps) { - printRequirements(step, print) - if (print) println() - } - - currentHelp = drawDisplay(print) } - private fun drawDisplay(print: Boolean): MutableList { - val newCurrentHelp = mutableListOf() - newCurrentHelp.add("§6Bingo Step Helper:") + currentHelp = drawDisplay(print) + } - if (currentSteps.isEmpty()) { - newCurrentHelp.add("§cOpen the §e/bingo §ccard.") - } - for (currentStep in currentSteps) { - val text = getName(currentStep) - newCurrentHelp.add(" §7$text") - if (print) println(text) - } - if (print) println() - return newCurrentHelp - } + private fun drawDisplay(print: Boolean): MutableList { + val newCurrentHelp = mutableListOf() + newCurrentHelp.add("§6Bingo Step Helper:") - private fun printRequirements(step: NextStep, print: Boolean, parentDone: Boolean = false, depth: Int = 0) { - if (print) println(getName(step, parentDone, depth)) - var requirementsToDo = 0 - for (requirement in step.requirements) { - printRequirements(requirement, print, step.done || parentDone, depth + 1) - if (!requirement.done) { - requirementsToDo++ - } - } + if (currentSteps.isEmpty()) { + newCurrentHelp.add("§cOpen the §e/bingo §ccard.") + } + for (currentStep in currentSteps) { + val text = getName(currentStep) + newCurrentHelp.add(" §7$text") + if (print) println(text) + } + if (print) println() + return newCurrentHelp + } - if (!step.done && !parentDone && requirementsToDo == 0 && !currentSteps.contains(step)) { - currentSteps = currentSteps.editCopy { add(step) } + private fun printRequirements(step: NextStep, print: Boolean, parentDone: Boolean = false, depth: Int = 0) { + if (print) println(getName(step, parentDone, depth)) + var requirementsToDo = 0 + for (requirement in step.requirements) { + printRequirements(requirement, print, step.done || parentDone, depth + 1) + if (!requirement.done) { + requirementsToDo++ } } - private fun getName(step: NextStep, parentDone: Boolean = false, depth: Int = 0): String { - val prefix = " ".repeat(depth) + if (step.done) "[DONE] " else if (parentDone) "[done] " else "" - val suffix = if (step is ProgressionStep) progressDisplay(step) else "" - return prefix + step.displayName + suffix + if (!step.done && !parentDone && requirementsToDo == 0 && !currentSteps.contains(step)) { + currentSteps = currentSteps.editCopy { add(step) } } + } - private fun progressDisplay(step: ProgressionStep): String { - val having = step.amountHaving - return if (having > 0) { - val needed = step.amountNeeded - val percentage = LorenzUtils.formatPercentage(having.toDouble() / needed) - " $percentage (${having.addSeparators()}/${needed.addSeparators()})" - } else "" - } + private fun getName(step: NextStep, parentDone: Boolean = false, depth: Int = 0): String { + val prefix = " ".repeat(depth) + if (step.done) "[DONE] " else if (parentDone) "[done] " else "" + val suffix = if (step is ProgressionStep) progressDisplay(step) else "" + return prefix + step.displayName + suffix + } + + private fun progressDisplay(step: ProgressionStep): String { + val having = step.amountHaving + return if (having > 0) { + val needed = step.amountNeeded + val percentage = LorenzUtils.formatPercentage(having.toDouble() / needed) + " $percentage (${having.addSeparators()}/${needed.addSeparators()})" + } else "" } init { diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt index 0986caa70cb8..2a630f90b294 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ArachneChatMessageHider { +object ArachneChatMessageHider { private val config get() = SkyHanniMod.feature.chat private var hideArachneDeadMessage = false @@ -27,6 +27,7 @@ class ArachneChatMessageHider { "spawn", "§c\\[BOSS] Arachne§r§f: (?:The Era of Spiders begins now\\.|Ahhhh\\.\\.\\.A Calling\\.\\.\\.)" ) + // TODO more repo patterns @SubscribeEvent fun onChat(event: LorenzChatEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index b228300cc70c..0449f6a65c3c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern -class ChatFilter { +object ChatFilter { private val generalConfig get() = SkyHanniMod.feature.chat private val config get() = SkyHanniMod.feature.chat.filterType diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt index b4b8b10eb3da..a2922b1b1a85 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class CompactBestiaryChatMessage { +object CompactBestiaryChatMessage { private var inBestiary = false private var bestiaryDescription = mutableListOf() @@ -23,6 +23,8 @@ class CompactBestiaryChatMessage { private val milestonePattern = "^.+(§8\\d{1,3}➡§e\\d{1,3})$".toRegex() + // TODO more repo patterns + @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt index 8b4762948bfc..4a94c5759ff7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactSplashPotionMessage.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class CompactSplashPotionMessage { +object CompactSplashPotionMessage { private val config get() = SkyHanniMod.feature.chat.compactPotionMessages diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt index fec57de27135..13c5a72afbbf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt @@ -16,7 +16,9 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class PlayerDeathMessages { +object PlayerDeathMessages { + + private val config get() = SkyHanniMod.feature.gui.markedPlayers private val lastTimePlayerSeen = mutableMapOf() @@ -40,12 +42,12 @@ class PlayerDeathMessages { val message = event.message deathMessagePattern.matchMatcher(message) { val name = group("name") - if (MarkedPlayerManager.config.highlightInChat && + if (config.highlightInChat && !DungeonAPI.inDungeon() && !LorenzUtils.inKuudraFight && MarkedPlayerManager.isMarkedPlayer(name) ) { val reason = group("reason").removeColor() - val color = MarkedPlayerManager.config.chatColor.getChatColor() + val color = config.chatColor.getChatColor() ChatUtils.chat(" §c☠ $color$name §7$reason", false) event.blockedReason = "marked_player_death" return diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/RareDropMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/RareDropMessages.kt index 964f125683c1..15465cabd10d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/RareDropMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/RareDropMessages.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.util.ChatComponentText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class RareDropMessages { +object RareDropMessages { private val chatGroup = RepoPattern.group("pet.chatdrop") diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/SkyblockXPInChat.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/SkyblockXPInChat.kt index 190ddb493350..56e7fd514361 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/SkyblockXPInChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/SkyblockXPInChat.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.events.ActionBarValueUpdateEvent import at.hannibal2.skyhanni.utils.ChatUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SkyblockXPInChat { +object SkyblockXPInChat { val config get() = SkyHanniMod.feature.chat.skyBlockXPInChat diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt index b64a6ace6199..53f24584aac1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt @@ -18,8 +18,11 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent // TODO split into two classes: TranslatorCommand and GoogleTranslator. only communicates via getTranslationFromEnglish and getTranslationToEnglish -class Translator { +object Translator { + private val config get() = SkyHanniMod.feature.chat + + //TODO ??????????????????? private val messageContentRegex = Regex(".*: (.*)") // Logic for listening for a user click on a chat message is from NotEnoughUpdates @@ -46,52 +49,47 @@ class Translator { return style } - companion object { - - private val config get() = SkyHanniMod.feature.chat - - fun toEnglish(args: Array) { - val message = args.joinToString(" ").removeColor() + fun toEnglish(args: Array) { + val message = args.joinToString(" ").removeColor() - coroutineScope.launch { - GoogleTranslator.translate(message, "auto", "en").run( - { - if (it is GoogleTranslator.SameLanguageError) { - ChatUtils.userError("The source and target languages are the same (${it.lang})") - } else { - ChatUtils.userError("Unable to translate message, an error occurred: ${it.message}") - } - }, - { ChatUtils.chat("Found translation: §f${it.text}") } - ) - } + coroutineScope.launch { + GoogleTranslator.translate(message, "auto", "en").run( + { + if (it is GoogleTranslator.SameLanguageError) { + ChatUtils.userError("The source and target languages are the same (${it.lang})") + } else { + ChatUtils.userError("Unable to translate message, an error occurred: ${it.message}") + } + }, + { ChatUtils.chat("Found translation: §f${it.text}") } + ) } + } - fun fromEnglish(args: Array) { - if (args.size < 2 || args[0].length != 2) { // args[0] is the language code - ChatUtils.userError("Usage: /shcopytranslation ") - return - } - val language = args[0] - val message = args.drop(1).joinToString(" ") - - coroutineScope.launch { - GoogleTranslator.translate(message, "en", language).run( - { - if (it is GoogleTranslator.SameLanguageError) { - ChatUtils.userError("Could not translate message, the source and target languages are the same (${it.lang})") - } else { - ChatUtils.userError("Unable to translate message, an error occurred: ${it.message}") - } - }, - { - ChatUtils.chat("Copied translation to clipboard: §f${it.text}") - OS.copyToClipboard(it.text) + fun fromEnglish(args: Array) { + if (args.size < 2 || args[0].length != 2) { // args[0] is the language code + ChatUtils.userError("Usage: /shcopytranslation ") + return + } + val language = args[0] + val message = args.drop(1).joinToString(" ") + + coroutineScope.launch { + GoogleTranslator.translate(message, "en", language).run( + { + if (it is GoogleTranslator.SameLanguageError) { + ChatUtils.userError("Could not translate message, the source and target languages are the same (${it.lang})") + } else { + ChatUtils.userError("Unable to translate message, an error occurred: ${it.message}") } - ) - } + }, + { + ChatUtils.chat("Copied translation to clipboard: §f${it.text}") + OS.copyToClipboard(it.text) + } + ) } - - fun isEnabled() = config.translator } + + fun isEnabled() = config.translator } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt index 431167a8e810..862d4827c264 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt @@ -7,12 +7,16 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class WatchdogHider { +object WatchdogHider { private var inWatchdog = false private var blockedLines = 0 private var startLineComponent: IChatComponent? = null + private const val WATCHDOG_START_LINE = "§f" + private const val WATCHDOG_ANNOUNCEMENT_LINE = "§4[WATCHDOG ANNOUNCEMENT]" + private const val WATCHDOG_END_LINE = "§c" + @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.onHypixel || !SkyHanniMod.feature.chat.filterType.watchDog) return @@ -44,13 +48,6 @@ class WatchdogHider { } } } - - companion object { - - private const val WATCHDOG_START_LINE = "§f" - private const val WATCHDOG_ANNOUNCEMENT_LINE = "§4[WATCHDOG ANNOUNCEMENT]" - private const val WATCHDOG_END_LINE = "§c" - } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt index a1ff5e7a1c5a..99870929a656 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt @@ -6,22 +6,18 @@ import at.hannibal2.skyhanni.utils.MultiFilter import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class PlayerChatFilter { +object PlayerChatFilter { - companion object { + private val filters = mutableMapOf() - private val filters = mutableMapOf() - - fun shouldChatFilter(original: IChatComponent): Boolean { - val message = original.formattedText.lowercase() - for (filter in filters) { - filter.value.matchResult(message)?.let { - return true - } + fun shouldChatFilter(original: IChatComponent): Boolean { + val message = original.formattedText.lowercase() + for (filter in filters) { + filter.value.matchResult(message)?.let { + return true } - - return false } + return false } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt index ddd2ea4b260c..197a3d198901 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt @@ -9,7 +9,7 @@ import net.minecraft.event.HoverEvent import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class PlayerChatModifier { +object PlayerChatModifier { private val config get() = SkyHanniMod.feature.chat.playerMessage private val patterns = mutableListOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt index c589922cf4be..a1faa0441e99 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchFirst import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class FerocityDisplay { +object FerocityDisplay { private val config get() = SkyHanniMod.feature.combat.ferocityDisplay /** diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/HideDamageSplash.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/HideDamageSplash.kt index 986934745ff0..7ff1b26ed479 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/HideDamageSplash.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/HideDamageSplash.kt @@ -8,7 +8,7 @@ import net.minecraft.entity.EntityLivingBase import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class HideDamageSplash { +object HideDamageSplash { @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderLiving(event: SkyHanniRenderEntityEvent.Specials.Pre) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt index 390d75cabc79..e44a217a5c7d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt @@ -24,7 +24,7 @@ import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil.formatText import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil.isUsingCTGhostCounter import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil.preFormat import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil.prettyTime -import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.getBazaarData +import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.getBazaarData import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ChatUtils.chat import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AreaMiniBossFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AreaMiniBossFeatures.kt index 9f1faf10c318..44949a2c567c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AreaMiniBossFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AreaMiniBossFeatures.kt @@ -23,7 +23,7 @@ import net.minecraft.entity.passive.EntityWolf import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class AreaMiniBossFeatures { +object AreaMiniBossFeatures { private val config get() = SkyHanniMod.feature.combat.mobs private var lastSpawnTime = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AshfangMinisNametagHider.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AshfangMinisNametagHider.kt index dc05046ade82..d3ea7cd358d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AshfangMinisNametagHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/AshfangMinisNametagHider.kt @@ -8,7 +8,7 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class AshfangMinisNametagHider { +object AshfangMinisNametagHider { private val config get() = SkyHanniMod.feature.combat.mobs diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt index 660c7acf4211..72100e111430 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt @@ -19,7 +19,7 @@ import net.minecraft.entity.monster.EntitySpider import net.minecraft.init.Blocks import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class MobHighlight { +object MobHighlight { private val config get() = SkyHanniMod.feature.combat.mobs diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt index a847a1e5dd81..3f1f35eb0b55 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt @@ -23,7 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds -class SpawnTimers { +object SpawnTimers { private val config get() = SkyHanniMod.feature.combat.mobs diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt index 70b94c79525e..220b05440734 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LocationUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SendCoordinatedCommand { +object SendCoordinatedCommand { @SubscribeEvent fun onMessageSendToServer(event: MessageSendToServerEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt index 0401c0edb5f9..c8ae390acd4f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class WarpIsCommand { +object WarpIsCommand { @SubscribeEvent fun onMessageSendToServer(event: MessageSendToServerEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt index d5f963a469b2..af3369237d7d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt @@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor -import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine @@ -15,14 +14,13 @@ import at.hannibal2.skyhanni.utils.getLorenzVec import at.hannibal2.skyhanni.utils.getPrevLorenzVec import at.hannibal2.skyhanni.utils.mc.McPlayer import at.hannibal2.skyhanni.utils.mc.McWorld -import net.minecraft.client.Minecraft import net.minecraft.entity.projectile.EntityArrow import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.LinkedList import kotlin.time.DurationUnit import kotlin.time.toDuration -class ArrowTrail { +object ArrowTrail { private val config get() = SkyHanniMod.feature.gui.cosmetic.arrowTrail diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt index fc51f8c86193..aeeb6aa8c4b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt @@ -20,7 +20,7 @@ import java.awt.Color import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds -class CosmeticFollowingLine { +object CosmeticFollowingLine { private val config get() = SkyHanniMod.feature.gui.cosmetic.followingLine diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt index ae9e857f3006..9d4bf864252c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt @@ -30,7 +30,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class CroesusChestTracker { +object CroesusChestTracker { private val config get() = SkyHanniMod.feature.dungeon.chest @@ -48,10 +48,10 @@ class CroesusChestTracker { private val openedPattern by patternGroup.pattern("chest.state.opened", "§8Opened Chest:.*") private val unopenedPattern by patternGroup.pattern("chest.state.unopened", "§8No Chests Opened!") - private val kismetSlotId = 50 - private val emptySlotId = 22 - private val frontArrowSlotId = 53 - private val backArrowSlotId = 45 + private const val KISMET_SLOT = 50 + private const val EMPTY_SLOT = 22 + private const val FRONT_ARROW_SLOT = 53 + private const val BACK_ARROW_SLOT = 45 private var inCroesusInventory = false private var croesusEmpty = false @@ -64,6 +64,10 @@ class CroesusChestTracker { private var kismetAmountCache = 0 + const val MAX_CHESTS = 60 + + private val croesusChests get() = ProfileStorageData.profileSpecific?.dungeons?.runs + @SubscribeEvent(priority = EventPriority.LOW) fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { if (!LorenzUtils.inSkyBlock) return @@ -116,7 +120,7 @@ class CroesusChestTracker { kismetAmountCache = McPlayer.countItems(SkyhanniItems.KISMET_FEATHER(), true) } if (config.showUsedKismets) { - val kismetItem = event.inventoryItems[kismetSlotId] ?: return + val kismetItem = event.inventoryItems[KISMET_SLOT] ?: return if (config.showUsedKismets && kismetUsedPattern.matches(kismetItem.getLore().lastOrNull())) setKismetUsed() } @@ -152,8 +156,8 @@ class CroesusChestTracker { private fun pageSetup(event: InventoryFullyOpenedEvent) { inCroesusInventory = true pageSwitchable = true - croesusEmpty = croesusEmptyPattern.matches(event.inventoryItems[emptySlotId]?.name) - if (event.inventoryItems[backArrowSlotId]?.item != Items.arrow) { + croesusEmpty = croesusEmptyPattern.matches(event.inventoryItems[EMPTY_SLOT]?.name) + if (event.inventoryItems[BACK_ARROW_SLOT]?.item != Items.arrow) { currentPage = 0 } } @@ -174,19 +178,19 @@ class CroesusChestTracker { fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.showUsedKismets) return - if (chestInventory != null && event.slotId == kismetSlotId) { + if (chestInventory != null && event.slotId == KISMET_SLOT) { setKismetUsed() return } if (inCroesusInventory && !croesusEmpty) { if (event.slot == null) return when (event.slotId) { - frontArrowSlotId -> if (pageSwitchable && event.slot.stack.isArrow()) { + FRONT_ARROW_SLOT -> if (pageSwitchable && event.slot.stack.isArrow()) { pageSwitchable = false currentPage++ } - backArrowSlotId -> if (pageSwitchable && event.slot.stack.isArrow()) { + BACK_ARROW_SLOT -> if (pageSwitchable && event.slot.stack.isArrow()) { pageSwitchable = false currentPage-- } @@ -224,7 +228,7 @@ class CroesusChestTracker { if (event.floor == "E") return croesusChests?.add(0, DungeonRunInfo(event.floor)) currentRunIndex = 0 - if ((croesusChests?.size ?: 0) > maxChests) { + if ((croesusChests?.size ?: 0) > MAX_CHESTS) { croesusChests?.dropLast(1) } } @@ -252,26 +256,22 @@ class CroesusChestTracker { private inline fun runSlots(slotId: Int, any: T) = croesusSlotMapToRun(slotId)?.getRun()?.let { it to any } - companion object { - val maxChests = 60 - - private val croesusChests get() = ProfileStorageData.profileSpecific?.dungeons?.runs + fun resetChest() = croesusChests?.let { + it.clear() + it.addAll(generateMaxChest()) + ChatUtils.chat("Kismet State was cleared!") + } - fun resetChest() = croesusChests?.let { - it.clear() - it.addAll(generateMaxChest()) - ChatUtils.chat("Kismet State was cleared!") - } + fun generateMaxChest() = generateSequence { DungeonRunInfo() }.take(MAX_CHESTS) - fun generateMaxChest() = generateSequence { DungeonRunInfo() }.take(maxChests) - fun generateMaxChestAsList() = generateMaxChest().toList() + @JvmStatic + fun generateMaxChestAsList() = generateMaxChest().toList() - fun getLastActiveChest(includeDungeonKey: Boolean = false) = - (croesusChests?.indexOfLast { - it.floor != null && - (it.openState == OpenedState.UNOPENED || (includeDungeonKey && it.openState == OpenedState.OPENED)) - } ?: -1) + 1 - } + fun getLastActiveChest(includeDungeonKey: Boolean = false) = + (croesusChests?.indexOfLast { + it.floor != null && + (it.openState == OpenedState.UNOPENED || (includeDungeonKey && it.openState == OpenedState.OPENED)) + } ?: -1) + 1 enum class OpenedState { UNOPENED, diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt index d01b1690654a..f19d08d526d9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class DungeonArchitectFeatures { +object DungeonArchitectFeatures { private val config get() = SkyHanniMod.feature.dungeon private val patternGroup = RepoPattern.group("dungeon.architectsdraft") diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt index 6f5a83a851cb..dbe8384bf9bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt @@ -7,7 +7,7 @@ import net.minecraft.entity.EntityLivingBase import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class DungeonBossHideDamageSplash { +object DungeonBossHideDamageSplash { @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderLiving(event: SkyHanniRenderEntityEvent.Specials.Pre) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt index dc4a6182ddba..6f5c971ff89c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class DungeonBossMessages { +object DungeonBossMessages { private val config get() = SkyHanniMod.feature.chat private val bossPattern = "§([cd4])\\[BOSS] (.*)".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt index 495ff56a916c..42e33283c8e3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt @@ -10,7 +10,7 @@ import java.util.regex.Pattern private typealias MessageTypes = ChatConfig.DungeonMessageTypes -class DungeonChatFilter { +object DungeonChatFilter { private val config get() = SkyHanniMod.feature.chat diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt index ddf76399cbd7..7bd4fc3a33ff 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -17,7 +17,7 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityGuardian import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class DungeonCleanEnd { +object DungeonCleanEnd { private val config get() = SkyHanniMod.feature.dungeon.cleanEnd private val catacombsPattern by RepoPattern.pattern( diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt index 6b0684a526f1..a069c8bbc4d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt @@ -15,7 +15,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class DungeonCopilot { +object DungeonCopilot { private val config get() = SkyHanniMod.feature.dungeon.dungeonCopilot diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt index 8ac451c8566b..eb0bb7fd3f9f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt @@ -10,7 +10,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils.matches import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class DungeonDeathCounter { +object DungeonDeathCounter { private val config get() = SkyHanniMod.feature.dungeon private var display = "" diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt index fe59aa68927a..a3f31b03351a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt @@ -21,7 +21,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent // TODO Remove all removeColor calls in this class. Deal with the color code in regex. -class DungeonFinderFeatures { +object DungeonFinderFeatures { private val config get() = SkyHanniMod.feature.dungeon.partyFinder // Repo group and patterns diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt index 640032b17086..f06359c851c9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt @@ -18,7 +18,7 @@ import net.minecraft.entity.item.EntityItem import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class DungeonHideItems { +object DungeonHideItems { private val config get() = SkyHanniMod.feature.dungeon.objectHider @@ -27,25 +27,25 @@ class DungeonHideItems { // TODO put in skull data repo part - private val soulWeaverHider = + private const val SOUL_WEAVER_HIDER = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmYyNGVkNjg3NTMwNGZhNGExZjBjNzg1YjJjYjZhNmE3MjU2M2U5ZjNlMjRlYTU1ZTE4MTc4NDUyMTE5YWE2NiJ9fX0=" - private val blessingTexture = + private const val BLESSING_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTkzZTIwNjg2MTc4NzJjNTQyZWNkYTFkMjdkZjRlY2U5MWM2OTk5MDdiZjMyN2M0ZGRiODUzMDk0MTJkMzkzOSJ9fX0=" - private val reviveStoneTexture = + private const val REVIVE_STONE_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjZhNzZjYzIyZTdjMmFiOWM1NDBkMTI0NGVhZGJhNTgxZjVkZDllMThmOWFkYWNmMDUyODBhNWI0OGI4ZjYxOCJ9fX0K" - private val premiumFleshTexture = + private const val PREMIUM_FLESH_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWE3NWU4YjA0NGM3MjAxYTRiMmU4NTZiZTRmYzMxNmE1YWFlYzY2NTc2MTY5YmFiNTg3MmE4ODUzNGI4MDI1NiJ9fX0K" - private val abilityOrbTexture = + private const val ABILITY_ORB_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTAxZTA0MGNiMDFjZjJjY2U0NDI4MzU4YWUzMWQyZTI2NjIwN2M0N2NiM2FkMTM5NzA5YzYyMDEzMGRjOGFkNCJ9fX0=" - private val supportOrbTexture = + private const val SUPPORT_ORB_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTMxYTRmYWIyZjg3ZGI1NDMzMDEzNjUxN2I0NTNhYWNiOWQ3YzBmZTc4NDMwMDcwOWU5YjEwOWNiYzUxNGYwMCJ9fX0=" - private val damageOrbTexture = + private const val DAMAGE_ORB_TEXTURE = "eyJ0aW1lc3RhbXAiOjE1NzQ5NTEzMTkwNDQsInByb2ZpbGVJZCI6IjE5MjUyMWI0ZWZkYjQyNWM4OTMxZjAyYTg0OTZlMTFiIiwicHJvZmlsZU5hbWUiOiJTZXJpYWxpemFibGUiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2FiODZkYTJlMjQzYzA1ZGMwODk4YjBjYzVkM2U2NDg3NzE3MzE3N2UwYTIzOTQ0MjVjZWMxMDAyNTljYjQ1MjYifX19" - private val healerFairyTexture = + private const val HEALER_FAIRY_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTZjM2UzMWNmYzY2NzMzMjc1YzQyZmNmYjVkOWE0NDM0MmQ2NDNiNTVjZDE0YzljNzdkMjczYTIzNTIifX19" private fun isSkeletonSkull(entity: EntityArmorStand): Boolean { @@ -90,7 +90,7 @@ class DungeonHideItems { event.isCanceled = true } - if (skullTexture == blessingTexture) { + if (skullTexture == BLESSING_TEXTURE) { event.isCanceled = true } } @@ -100,7 +100,7 @@ class DungeonHideItems { event.isCanceled = true } - if (skullTexture == reviveStoneTexture) { + if (skullTexture == REVIVE_STONE_TEXTURE) { event.isCanceled = true hideParticles[entity] = System.currentTimeMillis() } @@ -112,7 +112,7 @@ class DungeonHideItems { hideParticles[entity] = System.currentTimeMillis() } - if (skullTexture == premiumFleshTexture) { + if (skullTexture == PREMIUM_FLESH_TEXTURE) { event.isCanceled = true } } @@ -136,9 +136,9 @@ class DungeonHideItems { } when (skullTexture) { - abilityOrbTexture, - supportOrbTexture, - damageOrbTexture, + ABILITY_ORB_TEXTURE, + SUPPORT_ORB_TEXTURE, + DAMAGE_ORB_TEXTURE, -> { event.isCanceled = true hideParticles[entity] = System.currentTimeMillis() @@ -149,14 +149,14 @@ class DungeonHideItems { if (config.hideHealerFairy) { // Healer Fairy texture is stored in id 0, not id 4 for some reasos. - if (entity.inventory[0]?.getSkullTexture() == healerFairyTexture) { + if (entity.inventory[0]?.getSkullTexture() == HEALER_FAIRY_TEXTURE) { event.isCanceled = true return } } if (config.hideSoulweaverSkulls) { - if (skullTexture == soulWeaverHider) { + if (skullTexture == SOUL_WEAVER_HIDER) { event.isCanceled = true return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt index 3e0a719fa4cd..8a8db81e1f5c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt @@ -7,7 +7,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class DungeonRankTabListColor { +object DungeonRankTabListColor { private val config get() = SkyHanniMod.feature.dungeon.tabList private val pattern = "§r(?.*) §r§f\\(§r§d(?.*) (?.*)§r§f\\)§r".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonShadowAssassinNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonShadowAssassinNotification.kt index 45684106547f..34da5b88fd5b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonShadowAssassinNotification.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonShadowAssassinNotification.kt @@ -10,7 +10,7 @@ import net.minecraft.network.play.server.S44PacketWorldBorder import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class DungeonShadowAssassinNotification { +object DungeonShadowAssassinNotification { private val config get() = SkyHanniMod.feature.dungeon @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt index 2575d4431dff..6acf731c9e7d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt @@ -10,7 +10,7 @@ import net.minecraft.scoreboard.ScorePlayerTeam import net.minecraft.scoreboard.Team import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class DungeonTeammateOutlines { +object DungeonTeammateOutlines { private val config get() = SkyHanniMod.feature.dungeon diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt index 670a6ebea5ba..c2af1acdda58 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt @@ -16,7 +16,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.findMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class DungeonsRaceGuide { +object DungeonsRaceGuide { private val config get() = SkyHanniMod.feature.dungeon.dungeonsRaceGuide private val raceActivePattern by RepoPattern.pattern( diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt index fa06c1eed7ef..4a4c74cdbe3a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.utils.LorenzColor import net.minecraft.entity.monster.EntitySilverfish import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class HighlightDungeonDeathmite { +object HighlightDungeonDeathmite { @SubscribeEvent fun onEntityHealthUpdate(event: EntityMaxHealthUpdateEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt index 747331ad8a63..53a537d4c23d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt @@ -9,7 +9,7 @@ import net.minecraft.entity.EntityLivingBase import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class TerracottaPhase { +object TerracottaPhase { private val config get() = SkyHanniMod.feature.dungeon.terracottaPhase diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt index a08db634de14..b1a660e0003f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt @@ -18,7 +18,7 @@ import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class BurrowWarpHelper { +object BurrowWarpHelper { private var lastWarpTime = SimpleTimeMark.farPast() private var lastWarp: WarpPoint? = null @@ -90,37 +90,34 @@ class BurrowWarpHelper { event.addData(list) } - companion object { - - private val config get() = SkyHanniMod.feature.event.diana - var currentWarp: WarpPoint? = null - - fun shouldUseWarps(target: LorenzVec, debug: MutableList? = null) { - debug?.add("target: ${target.printWithAccuracy(1)}") - val playerLocation = LocationUtils.playerLocation() - debug?.add("playerLocation: ${playerLocation.printWithAccuracy(1)}") - val warpPoint = getNearestWarpPoint(target) - debug?.add("warpPoint: ${warpPoint.displayName}") - - val playerDistance = playerLocation.distance(target) - debug?.add("playerDistance: ${playerDistance.roundTo(1)}") - val warpDistance = warpPoint.distance(target) - debug?.add("warpDistance: ${warpDistance.roundTo(1)}") - val difference = playerDistance - warpDistance - debug?.add("difference: ${difference.roundTo(1)}") - val setWarpPoint = difference > 10 - debug?.add("setWarpPoint: $setWarpPoint") - currentWarp = if (setWarpPoint) warpPoint else null - } + private val config get() = SkyHanniMod.feature.event.diana + var currentWarp: WarpPoint? = null + + fun shouldUseWarps(target: LorenzVec, debug: MutableList? = null) { + debug?.add("target: ${target.printWithAccuracy(1)}") + val playerLocation = LocationUtils.playerLocation() + debug?.add("playerLocation: ${playerLocation.printWithAccuracy(1)}") + val warpPoint = getNearestWarpPoint(target) + debug?.add("warpPoint: ${warpPoint.displayName}") + + val playerDistance = playerLocation.distance(target) + debug?.add("playerDistance: ${playerDistance.roundTo(1)}") + val warpDistance = warpPoint.distance(target) + debug?.add("warpDistance: ${warpDistance.roundTo(1)}") + val difference = playerDistance - warpDistance + debug?.add("difference: ${difference.roundTo(1)}") + val setWarpPoint = difference > 10 + debug?.add("setWarpPoint: $setWarpPoint") + currentWarp = if (setWarpPoint) warpPoint else null + } - private fun getNearestWarpPoint(location: LorenzVec) = - WarpPoint.entries.filter { it.unlocked && !it.ignored() }.map { it to it.distance(location) } - .sorted().first().first + private fun getNearestWarpPoint(location: LorenzVec) = + WarpPoint.entries.filter { it.unlocked && !it.ignored() }.map { it to it.distance(location) } + .sorted().first().first - fun resetDisabledWarps() { - WarpPoint.entries.forEach { it.unlocked = true } - ChatUtils.chat("Reset disabled burrow warps.") - } + fun resetDisabledWarps() { + WarpPoint.entries.forEach { it.unlocked = true } + ChatUtils.chat("Reset disabled burrow warps.") } enum class WarpPoint( diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt index 3c2623fea85d..a5e8944730b2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class GriffinPetWarning { +object GriffinPetWarning { private var lastWarnTime = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt index dd48e28c5e19..513c6c9f7347 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt @@ -8,7 +8,7 @@ import net.minecraft.entity.player.EntityPlayer import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class HighlightInquisitors { +object HighlightInquisitors { private val config get() = SkyHanniMod.feature.event.diana diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt index bb793252483f..a39bedadd609 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt @@ -22,7 +22,7 @@ import kotlin.math.sin * Taken and ported from Soopyboo32's javascript module SoopyV2 */ // TODO fix whatever is going on in this file -class SoopyGuessBurrow { +object SoopyGuessBurrow { private var dingIndex = 0 private var hasDinged = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/HighlightJerries.kt b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/HighlightJerries.kt index 7f3dfb9c9b36..c67fa14bb063 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/HighlightJerries.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/HighlightJerries.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.entity.passive.EntityVillager import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class HighlightJerries { +object HighlightJerries { private val config get() = SkyHanniMod.feature.event.jerry diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt index ffb26bb5ee60..fa7179f854c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt @@ -21,7 +21,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent // todo: create abstract class for this and BasketWaypoints -class PresentWaypoints { +object PresentWaypoints { private val config get() = SkyHanniMod.feature.event.lobbyWaypoints.christmasPresent private var presentLocations = mapOf>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt index bdc74f52edde..30ac35126dc9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class EasterEggWaypoints { +object EasterEggWaypoints { private val config get() = SkyHanniMod.feature.event.lobbyWaypoints.easterEgg private var closest: EasterEgg? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt index 8eb9e1dc15e3..4090ac3e7133 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class BasketWaypoints { +object BasketWaypoints { private val config get() = SkyHanniMod.feature.event.lobbyWaypoints.halloweenBasket private var closest: Basket? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt b/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt index b8140e3233e6..1c5b7181c5e3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/spook/TheGreatSpook.kt @@ -10,7 +10,7 @@ import at.hannibal2.skyhanni.utils.mc.McSound import at.hannibal2.skyhanni.utils.mc.McSound.play import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class TheGreatSpook { +object TheGreatSpook { // §r§cPrimal Fears§r§7: §r§6§lREADY!! private val config get() = SkyHanniMod.feature.event.spook diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt index b8b79b990539..636fba47e0f7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt @@ -17,7 +17,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds -class JyrreTimer { +object JyrreTimer { private val config get() = SkyHanniMod.feature.event.winter.jyrreTimer private val drankBottlePattern by RepoPattern.pattern( diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt index 6e1905cc802a..9c71ffb2ca92 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt @@ -17,7 +17,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class NewYearCakeReminder { +object NewYearCakeReminder { private val config get() = SkyHanniMod.feature.event.winter private val sidebarDetectionPattern by RepoPattern.pattern( diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt index b26a05094b4d..c2bcaf61f18a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt @@ -17,12 +17,17 @@ import kotlin.time.Duration import kotlin.time.Duration.Companion.days import kotlin.time.Duration.Companion.seconds -class AccountUpgradeReminder { +object AccountUpgradeReminder { private var inInventory = false private var duration: Duration? = null private var lastReminderSend = SimpleTimeMark.farPast() + // TODO make into repo pattern + private val durationRegex = "§8Duration: (\\d{1,3})d".toRegex() + private val startedRegex = "§eYou started the §r§a(.+) §r§eupgrade!".toRegex() + private val claimedRegex = "§eYou claimed the §r§a.+ §r§eupgrade!".toRegex() + // TODO: find a way to save SimpleTimeMark directly in the config private var nextCompletionTime: SimpleTimeMark? get() = ProfileStorageData.playerSpecific?.nextAccountUpgradeCompletionTime?.asTimeMark() @@ -104,17 +109,10 @@ class AccountUpgradeReminder { nextCompletionTime = SimpleTimeMark.farPast() } - companion object { - - private val durationRegex = "§8Duration: (\\d{1,3})d".toRegex() - private val startedRegex = "§eYou started the §r§a(.+) §r§eupgrade!".toRegex() - private val claimedRegex = "§eYou claimed the §r§a.+ §r§eupgrade!".toRegex() - - private fun isEnabled() = SkyHanniMod.feature.misc.accountUpgradeReminder - - fun disable() { - SkyHanniMod.feature.misc.accountUpgradeReminder = false - ChatUtils.chat("Disabled account upgrade reminder.") - } + fun disable() { + SkyHanniMod.feature.misc.accountUpgradeReminder = false + ChatUtils.chat("Disabled account upgrade reminder.") } + + private fun isEnabled() = SkyHanniMod.feature.misc.accountUpgradeReminder } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt index 2a3ae36a75ad..154f0c77b6ce 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt @@ -39,7 +39,9 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class CityProjectFeatures { +object CityProjectFeatures { + + private val config get() = SkyHanniMod.feature.event.cityProject private var display = emptyList>() private var inInventory = false @@ -55,13 +57,9 @@ class CityProjectFeatures { "§aProject is (?:being built|released)!" ) - companion object { - - private val config get() = SkyHanniMod.feature.event.cityProject - fun disable() { - config.dailyReminder = false - ChatUtils.chat("Disabled city project reminder messages!") - } + fun disable() { + config.dailyReminder = false + ChatUtils.chat("Disabled city project reminder messages!") } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt index 61b2c68e3303..6e975a222299 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt @@ -15,7 +15,7 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class ChumBucketHider { +object ChumBucketHider { private val config get() = SkyHanniMod.feature.fishing.chumBucketHider private val titleEntity = TimeLimitedSet(5.seconds) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt index f31cde05fe46..74750de031da 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt @@ -19,7 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds -class FishingBaitWarnings { +object FishingBaitWarnings { private val config get() = SkyHanniMod.feature.fishing.fishingBaitWarnings diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt index 32e31edf09e8..823c106eeed1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt @@ -12,11 +12,12 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class FishingHookDisplay { +object FishingHookDisplay { private val config get() = SkyHanniMod.feature.fishing.fishingHookDisplay + private var armorStand: EntityArmorStand? = null - private val potentionArmorStands = mutableListOf() + private val potentialArmorStands = mutableListOf() private val pattern = "§e§l(\\d+(\\.\\d+)?)".toPattern() @SubscribeEvent @@ -34,7 +35,7 @@ class FishingHookDisplay { if (!isEnabled()) return if (armorStand == null) { - val filter = potentionArmorStands.filter { it.hasCustomName() && it.hasCorrectName() } + val filter = potentialArmorStands.filter { it.hasCustomName() && it.hasCorrectName() } if (filter.size == 1) { armorStand = filter[0] } @@ -42,7 +43,7 @@ class FishingHookDisplay { } private fun reset() { - potentionArmorStands.clear() + potentialArmorStands.clear() armorStand = null } @@ -52,7 +53,7 @@ class FishingHookDisplay { val entity = event.entity ?: return if (entity !is EntityArmorStand) return - potentionArmorStands.add(entity) + potentialArmorStands.add(entity) } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt index 4a7e4f054f17..850ac97e20f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt @@ -23,7 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds -class FishingTimer { +object FishingTimer { private val config get() = SkyHanniMod.feature.fishing.barnTimer private val barnLocation = LorenzVec(108, 89, -252) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt index 35be39581f74..f7fb3fab9fa6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt @@ -30,7 +30,7 @@ import net.minecraft.entity.player.EntityPlayer import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class SeaCreatureFeatures { +object SeaCreatureFeatures { private val config get() = SkyHanniMod.feature.fishing.rareCatches private var rareSeaCreatures = listOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt index a4ddf78c2da5..7773645643ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt @@ -8,10 +8,20 @@ import at.hannibal2.skyhanni.events.SeaCreatureFishEvent import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SeaCreatureManager { +object SeaCreatureManager { private var doubleHook = false + private val seaCreatureMap = mutableMapOf() + var allFishingMobs = mapOf() + var allVariants = mapOf>() + + // TODO repo pattern + private val doubleHookMessages = setOf( + "§eIt's a §r§aDouble Hook§r§e! Woot woot!", + "§eIt's a §r§aDouble Hook§r§e!" + ) + @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return @@ -57,23 +67,11 @@ class SeaCreatureManager { counter++ } } - SeaCreatureManager.allFishingMobs = allFishingMobs + this.allFishingMobs = allFishingMobs allVariants = variants } - companion object { - - private val seaCreatureMap = mutableMapOf() - var allFishingMobs = mapOf() - var allVariants = mapOf>() - - private val doubleHookMessages = setOf( - "§eIt's a §r§aDouble Hook§r§e! Woot woot!", - "§eIt's a §r§aDouble Hook§r§e!" - ) - - fun getSeaCreature(message: String): SeaCreature? { - return seaCreatureMap.getOrDefault(message, null) - } + private fun getSeaCreature(message: String): SeaCreature? { + return seaCreatureMap.getOrDefault(message, null) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt index 72997fc6da51..1a610bac0180 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.util.ChatComponentText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SeaCreatureMessageShortener { +object SeaCreatureMessageShortener { private val config get() = SkyHanniMod.feature.fishing diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt index 6f63134db8ea..5b67a81c4ce2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SharkFishCounter { +object SharkFishCounter { private var counter = mutableListOf(0, 0, 0, 0) private var display = "" diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt index 8434fd555650..78d128b76ddb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt @@ -18,7 +18,7 @@ import net.minecraft.entity.item.EntityItem import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds -class ShowFishingItemName { +object ShowFishingItemName { private val config get() = SkyHanniMod.feature.fishing.fishedItemName private var hasRodInHand = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt index c0d74ffdc906..5f858ebc0507 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt @@ -21,10 +21,10 @@ import net.minecraft.init.Blocks import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color -class ThunderSparksHighlight { +object ThunderSparksHighlight { private val config get() = SkyHanniMod.feature.fishing.thunderSpark - private val texture = + private const val SPARK_TEXTURE = "ewogICJ0aW1lc3RhbXAiIDogMTY0MzUwNDM3MjI1NiwKICAicHJvZmlsZUlkIiA6ICI2MzMyMDgwZTY3YTI0Y2MxYjE3ZGJhNzZmM2MwMGYxZCIsCiAgInByb2ZpbGVOYW1lIiA6ICJUZWFtSHlkcmEiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2IzMzI4ZDNlOWQ3MTA0MjAzMjI1NTViMTcyMzkzMDdmMTIyNzBhZGY4MWJmNjNhZmM1MGZhYTA0YjVjMDZlMSIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9" private val sparks = mutableListOf() @@ -33,7 +33,7 @@ class ThunderSparksHighlight { if (!isEnabled()) return McWorld.getEntitiesOf().filter { - it !in sparks && it.hasSkullTexture(texture) + it !in sparks && it.hasSkullTexture(SPARK_TEXTURE) }.forEach { sparks.add(it) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt index 174ec8bf0963..93ee356bab7a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt @@ -32,7 +32,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds -class TotemOfCorruption { +object TotemOfCorruption { private val config get() = SkyHanniMod.feature.fishing.totemOfCorruption diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt index 78765e675824..2cf9da6a3522 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt @@ -18,7 +18,7 @@ import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GeyserFishing { +object GeyserFishing { private val config get() = SkyHanniMod.feature.fishing.trophyFishing.geyserOptions private val geyserOffset = LorenzVec(0.1f, 0.6f, 0.1f) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt index 7ac180ae1bd1..83dfabcdac4c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.mc.McPlayer import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class OdgerWaypoint { +object OdgerWaypoint { private val config get() = SkyHanniMod.feature.fishing.trophyFishing private val location = LorenzVec(-373, 207, -808) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt index 9093cae899ec..4456c4540d6d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.input.Keyboard -class TrophyFishFillet { +object TrophyFishFillet { @SubscribeEvent fun onTooltip(event: LorenzToolTipEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt index 7e576e2f9d25..7c502df79d4c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt @@ -17,7 +17,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.util.ChatComponentText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class TrophyFishMessages { +object TrophyFishMessages { private val config get() = SkyHanniMod.feature.fishing.trophyFishing.chatMessages private val trophyFishPattern by RepoPattern.pattern( diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt index 7cc86392a1f9..880515fe7fa8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -24,15 +24,12 @@ import at.hannibal2.skyhanni.utils.renderables.Renderable import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class AnitaMedalProfit { +object AnitaMedalProfit { private val config get() = GardenAPI.config.anitaShop private var display = emptyList() - companion object { - - var inInventory = false - } + var inInventory = false enum class MedalType(val displayName: String, val factorBronze: Int) { GOLD("§6Gold medal", 8), diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt index 71009f489ee5..33287ff922cd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.datetime.SkyblockSeason import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class AtmosphericFilterDisplay { +object AtmosphericFilterDisplay { private val config get() = SkyHanniMod.feature.garden.atmosphericFilterDisplay diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt index f49f09428017..406549f54a87 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt @@ -19,7 +19,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GardenCropMilestoneFix { +object GardenCropMilestoneFix { private val patternGroup = RepoPattern.group("garden.cropmilestone.fix") /** diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt index ab5c1da27773..5692afffa062 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt @@ -30,7 +30,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds -class GardenLevelDisplay { +object GardenLevelDisplay { private val config get() = GardenAPI.config.gardenLevels private var useRomanNumerals: Boolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt index b1de446b0724..4b6e6dd83cdb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt @@ -22,7 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds -class GardenOptimalSpeed { +object GardenOptimalSpeed { private val config get() = GardenAPI.config.optimalSpeeds diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt index e2aa8084c7f0..c177deccb2e6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt @@ -13,7 +13,7 @@ import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class GardenWarpCommands { +object GardenWarpCommands { private val config get() = GardenAPI.config.gardenCommands diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt index 86601f7a9d51..70a4ebf61d9d 100755 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt @@ -12,7 +12,7 @@ import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class GardenYawAndPitch { +object GardenYawAndPitch { private val config get() = GardenAPI.config.yawPitchDisplay private var lastChange = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt index 4ca8bc99b742..7ebb12f9cf0f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt @@ -19,8 +19,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.text.DecimalFormat import kotlin.math.roundToInt -class ToolTooltipTweaks { +object ToolTooltipTweaks { + // TODO repo patterns private val config get() = GardenAPI.config.tooltipTweak private val tooltipFortunePattern = "^§5§o§7Farming Fortune: §a\\+([\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(\\d+)\\))?$".toRegex() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt index f6ebfb187931..fbaadbc4cdd3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -24,7 +24,7 @@ import kotlin.time.Duration import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds -class ComposterDisplay { +object ComposterDisplay { private val config get() = GardenAPI.config.composters private val storage get() = GardenAPI.storage @@ -34,21 +34,6 @@ class ComposterDisplay { private val bucket by lazy { SkyhanniItems.BUCKET().getItemStack() } private var tabListData by ComposterAPI::tabListData - enum class DataType(rawPattern: String, val icon: String) { - ORGANIC_MATTER(" Organic Matter: §r(.*)", "WHEAT"), - FUEL(" Fuel: §r(.*)", "OIL_BARREL"), - TIME_LEFT(" Time Left: §r(.*)", "WATCH"), - STORED_COMPOST(" Stored Compost: §r(.*)", "COMPOST"); - - val displayItem by lazy { icon.asInternalName().getItemStack() } - - val pattern by lazy { rawPattern.toPattern() } - - fun addToList(map: Map): List { - return listOf(displayItem, map[this]!!) - } - } - @SubscribeEvent fun onTabListUpdate(event: TabListUpdateEvent) { if (!(config.displayEnabled && GardenAPI.inGarden())) return @@ -198,4 +183,19 @@ class ComposterDisplay { } LorenzUtils.sendTitle("§eComposter Warning!", 3.seconds) } + + enum class DataType(rawPattern: String, val icon: NEUInternalName) { + ORGANIC_MATTER(" Organic Matter: §r(.*)", SkyhanniItems.WHEAT()), + FUEL(" Fuel: §r(.*)", SkyhanniItems.OIL_BARREL()), + TIME_LEFT(" Time Left: §r(.*)", SkyhanniItems.WATCH()), + STORED_COMPOST(" Stored Compost: §r(.*)", SkyhanniItems.COMPOST()); + + val displayItem by lazy { icon.getItemStack() } + + val pattern by lazy { rawPattern.toPattern() } + + fun addToList(map: Map): List { + return listOf(displayItem, map[this]!!) + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt index a80b71e93b97..bfc5925d4474 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ComposterInventoryNumbers { +object ComposterInventoryNumbers { private val patternGroup = RepoPattern.group("garden.composter.inventory.numbers") private val valuePattern by patternGroup.pattern( diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt index efab6415aefb..cc623c3b02d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt @@ -18,7 +18,7 @@ import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GardenComposterInventoryFeatures { +object GardenComposterInventoryFeatures { private val config get() = GardenAPI.config.composters diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt index 2faba37babcd..78dcac5313b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt @@ -20,7 +20,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.math.ceil import kotlin.time.Duration.Companion.milliseconds -class JacobContestFFNeededDisplay { +object JacobContestFFNeededDisplay { private val config get() = GardenAPI.config private var display = emptyList>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestStatsSummary.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestStatsSummary.kt index ee79c2b73386..e6adcd3397a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestStatsSummary.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestStatsSummary.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.datetime.TimeUtils.format import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class JacobContestStatsSummary { +object JacobContestStatsSummary { private val config get() = GardenAPI.config private var blocksBroken = 0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt index 6f9c00928e5c..be8e36b3a80e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt @@ -22,7 +22,7 @@ import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds -class JacobContestTimeNeeded { +object JacobContestTimeNeeded { private val config get() = GardenAPI.config private var display = emptyList>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt index 1bdac0d5e89c..367aa8e630f9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt @@ -31,7 +31,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.text.SimpleDateFormat import java.util.Locale -class JacobFarmingContestsInventory { +object JacobFarmingContestsInventory { private val realTime = mutableMapOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index 209a44a5514c..56a89d983ee3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -14,8 +14,8 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.isSpeedDataEmpty -import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.getBazaarData -import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.isBazaarItem +import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.getBazaarData +import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.isBazaarItem import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarData import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt index 5771f791d075..f382c73abe68 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt @@ -13,13 +13,16 @@ import at.hannibal2.skyhanni.utils.NumberUtil.roundTo import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class CropSpeedMeter { +object CropSpeedMeter { private var display = emptyList() private var currentCrop: CropType? = null private var currentBlocks = 0 private var snapshot = emptyList() + var enabled = false + private var startCrops = mapOf() + @SubscribeEvent fun onCropClick(event: CropClickEvent) { if (!isEnabled()) return @@ -112,16 +115,10 @@ class CropSpeedMeter { currentBlocks++ } - companion object { - - var enabled = false - private var startCrops = mapOf() - - fun toggle() { - enabled = !enabled - ChatUtils.chat("Crop Speed Meter " + if (enabled) "§aEnabled" else "§cDisabled") - startCrops = emptyMap() - } + fun toggle() { + enabled = !enabled + ChatUtils.chat("Crop Speed Meter " + if (enabled) "§aEnabled" else "§cDisabled") + startCrops = emptyMap() } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index 5b73a5f36c1a..fdfc061a8f13 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -43,7 +43,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds -class FarmingWeightDisplay { +object FarmingWeightDisplay { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent) { @@ -87,504 +87,502 @@ class FarmingWeightDisplay { } } - companion object { - private val config get() = GardenAPI.config.eliteFarmingWeights - private val localCounter = mutableMapOf() - - private var display = emptyList() - private var profileId = "" - private var lastLeaderboardUpdate = SimpleTimeMark.farPast() - private var apiError = false - private var leaderboardPosition = -1 - private var weight = -1.0 - private var localWeight = 0.0 - private var weightPerSecond = -1.0 - private var weightNeedsRecalculating = false - private var isLoadingWeight = false - private var isLoadingLeaderboard = false - private var rankGoal = -1 + private val config get() = GardenAPI.config.eliteFarmingWeights + private val localCounter = mutableMapOf() + + private var display = emptyList() + private var profileId = "" + private var lastLeaderboardUpdate = SimpleTimeMark.farPast() + private var apiError = false + private var leaderboardPosition = -1 + private var weight = -1.0 + private var localWeight = 0.0 + private var weightPerSecond = -1.0 + private var weightNeedsRecalculating = false + private var isLoadingWeight = false + private var isLoadingLeaderboard = false + private var rankGoal = -1 + + private var nextPlayers = mutableListOf() + private val nextPlayer get() = nextPlayers.firstOrNull() + + private val recalculate by lazy { + ({ + resetData() + }) + } - private var nextPlayers = mutableListOf() - private val nextPlayer get() = nextPlayers.firstOrNull() + private val eliteWeightApiGson by lazy { + ConfigManager.createBaseGsonBuilder() + .registerTypeAdapter(CropType::class.java, object : TypeAdapter() { + override fun write(out: JsonWriter, value: CropType) {} - private val recalculate by lazy { - ({ - resetData() - }) - } + override fun read(reader: JsonReader): CropType { + return CropType.getByName(reader.nextString()) + } + }.nullSafe()) + .registerTypeAdapter(PestType::class.java, object : TypeAdapter() { + override fun write(out: JsonWriter, value: PestType) {} - private val eliteWeightApiGson by lazy { - ConfigManager.createBaseGsonBuilder() - .registerTypeAdapter(CropType::class.java, object : TypeAdapter() { - override fun write(out: JsonWriter, value: CropType) {} - - override fun read(reader: JsonReader): CropType { - return CropType.getByName(reader.nextString()) - } - }.nullSafe()) - .registerTypeAdapter(PestType::class.java, object : TypeAdapter() { - override fun write(out: JsonWriter, value: PestType) {} - - override fun read(reader: JsonReader): PestType { - return PestType.getByName(reader.nextString()) - } - }.nullSafe()) - .create() - } + override fun read(reader: JsonReader): PestType { + return PestType.getByName(reader.nextString()) + } + }.nullSafe()) + .create() + } - private val errorMessage by lazy { - listOf( - Renderable.clickAndHover( - "§cFarming Weight error: Cannot load", - listOf("§eClick here to reload the data right now!"), - onClick = recalculate - ), Renderable.clickAndHover( - "§cdata from Elite Farmers!", - listOf("§eClick here to reload the data right now!"), - onClick = recalculate - ), Renderable.clickAndHover( - "§eRejoin the garden or", - listOf("§eClick here to reload the data right now!"), - onClick = recalculate - ), Renderable.clickAndHover( - "§eclick here to fix it.", - listOf("§eClick here to reload the data right now!"), - onClick = recalculate - ) + private val errorMessage by lazy { + listOf( + Renderable.clickAndHover( + "§cFarming Weight error: Cannot load", + listOf("§eClick here to reload the data right now!"), + onClick = recalculate + ), Renderable.clickAndHover( + "§cdata from Elite Farmers!", + listOf("§eClick here to reload the data right now!"), + onClick = recalculate + ), Renderable.clickAndHover( + "§eRejoin the garden or", + listOf("§eClick here to reload the data right now!"), + onClick = recalculate + ), Renderable.clickAndHover( + "§eclick here to fix it.", + listOf("§eClick here to reload the data right now!"), + onClick = recalculate ) - } + ) + } - private var lastOpenWebsite = SimpleTimeMark.farPast() + private var lastOpenWebsite = SimpleTimeMark.farPast() - private fun update() { - if (!isEnabled()) return - if (apiError) { - display = errorMessage - return - } + private fun update() { + if (!isEnabled()) return + if (apiError) { + display = errorMessage + return + } - if (weight == -1.0) { - if (!isLoadingWeight) { - val localProfile = HypixelData.profileName - - isLoadingWeight = true - if (display.isEmpty()) { - display = Renderable.singeltonString("§6Farming Weight§7: §eLoading..") - } - SkyHanniMod.coroutineScope.launch { - loadWeight(localProfile) - isLoadingWeight = false - } + if (weight == -1.0) { + if (!isLoadingWeight) { + val localProfile = HypixelData.profileName + + isLoadingWeight = true + if (display.isEmpty()) { + display = Renderable.singeltonString("§6Farming Weight§7: §eLoading..") + } + SkyHanniMod.coroutineScope.launch { + loadWeight(localProfile) + isLoadingWeight = false } - return } + return + } - val weight = getWeight() + val weight = getWeight() - if (rankGoal == -1) rankGoal = getRankGoal() - val leaderboard = getLeaderboard() + if (rankGoal == -1) rankGoal = getRankGoal() + val leaderboard = getLeaderboard() - val list = mutableListOf() - list.add( - Renderable.clickAndHover( - "§6Farming Weight§7: $weight$leaderboard", - listOf("§eClick to open your Farming Profile."), - onClick = { openWebsite(McPlayer.name) } - ) + val list = mutableListOf() + list.add( + Renderable.clickAndHover( + "§6Farming Weight§7: $weight$leaderboard", + listOf("§eClick to open your Farming Profile."), + onClick = { openWebsite(McPlayer.name) } ) + ) - if (isEtaEnabled() && (weightPerSecond != -1.0 || config.overtakeETAAlways)) { - getETA()?.let { - list.add(it) - } + if (isEtaEnabled() && (weightPerSecond != -1.0 || config.overtakeETAAlways)) { + getETA()?.let { + list.add(it) } - display = list } + display = list + } - private fun getLeaderboard(): String { - if (!config.leaderboard) return "" + private fun getLeaderboard(): String { + if (!config.leaderboard) return "" - // Fetching new leaderboard position every 10.5 minutes - if (lastLeaderboardUpdate.passedSince() > 10.5.minutes) { - loadLeaderboardIfAble() - } - - return if (leaderboardPosition != -1) { - val format = leaderboardPosition.addSeparators() - " §7[§b#$format§7]" - } else { - if (isLoadingLeaderboard) " §7[§b#?§7]" else "" - } + // Fetching new leaderboard position every 10.5 minutes + if (lastLeaderboardUpdate.passedSince() > 10.5.minutes) { + loadLeaderboardIfAble() } - private fun getWeight(): String { - if (weightNeedsRecalculating) { - val values = calculateCollectionWeight().values - if (values.isNotEmpty()) { - localWeight = values.sum() - weightNeedsRecalculating = false - } - } - - val totalWeight = (localWeight + weight) - return "§e" + totalWeight.roundTo(2).addSeparators() + return if (leaderboardPosition != -1) { + val format = leaderboardPosition.addSeparators() + " §7[§b#$format§7]" + } else { + if (isLoadingLeaderboard) " §7[§b#?§7]" else "" } + } - private fun getRankGoal(): Int { - val value = config.etaGoalRank - var goal = 10000 - - // Check that the provided string is valid - val parsed = value.toIntOrNull() ?: 0 - if (parsed < 1 || parsed > goal) { - ChatUtils.chatAndOpenConfig( - "Invalid Farming Weight Overtake Goal! Click here to edit the Overtake Goal config value " + - "to a valid number [1-10000] to use this feature!", - GardenAPI.config.eliteFarmingWeights::etaGoalRank - ) - config.etaGoalRank = goal.toString() - } else { - goal = parsed - } - - // Fetch the positions again if the goal was changed - if (rankGoal != goal) { - loadLeaderboardIfAble() + private fun getWeight(): String { + if (weightNeedsRecalculating) { + val values = calculateCollectionWeight().values + if (values.isNotEmpty()) { + localWeight = values.sum() + weightNeedsRecalculating = false } - - return goal } - private fun getETA(): Renderable? { - if (weight < 0) return null + val totalWeight = (localWeight + weight) + return "§e" + totalWeight.roundTo(2).addSeparators() + } - val nextPlayer = nextPlayer ?: return Renderable.clickAndHover( - "§cWaiting for leaderboard update...", - listOf("§eClick here to load new data right now!"), - onClick = recalculate + private fun getRankGoal(): Int { + val value = config.etaGoalRank + var goal = 10000 + + // Check that the provided string is valid + val parsed = value.toIntOrNull() ?: 0 + if (parsed < 1 || parsed > goal) { + ChatUtils.chatAndOpenConfig( + "Invalid Farming Weight Overtake Goal! Click here to edit the Overtake Goal config value " + + "to a valid number [1-10000] to use this feature!", + GardenAPI.config.eliteFarmingWeights::etaGoalRank ) - val showRankGoal = leaderboardPosition == -1 || leaderboardPosition > rankGoal - var nextName = - if (showRankGoal) "#$rankGoal" else nextPlayer.name + config.etaGoalRank = goal.toString() + } else { + goal = parsed + } - val totalWeight = (localWeight + weight) - var weightUntilOvertake = nextPlayer.weight - totalWeight + // Fetch the positions again if the goal was changed + if (rankGoal != goal) { + loadLeaderboardIfAble() + } - if (weightUntilOvertake < 0) { - if (weightPerSecond > 0) { - farmingChatMessage("You passed §b$nextName §ein the Farming Weight Leaderboard!") - } + return goal + } - // Lower leaderboard position - if (leaderboardPosition == -1) { - leaderboardPosition = 10000 - } else { - leaderboardPosition-- - } - GardenAPI.storage?.farmingWeight?.lastFarmingWeightLeaderboard = - leaderboardPosition + private fun getETA(): Renderable? { + if (weight < 0) return null - // Remove passed player to present the next one - nextPlayers.removeFirst() + val nextPlayer = nextPlayer ?: return Renderable.clickAndHover( + "§cWaiting for leaderboard update...", + listOf("§eClick here to load new data right now!"), + onClick = recalculate + ) + val showRankGoal = leaderboardPosition == -1 || leaderboardPosition > rankGoal + var nextName = + if (showRankGoal) "#$rankGoal" else nextPlayer.name - // Display waiting message if nextPlayers list is empty - // Update values to next player - nextName = nextPlayer.name - weightUntilOvertake = nextPlayer.weight - totalWeight - } + val totalWeight = (localWeight + weight) + var weightUntilOvertake = nextPlayer.weight - totalWeight - if (nextPlayer.weight == 0.0) { - return Renderable.clickAndHover( - "§cRejoin the garden to show ETA!", - listOf("Click here to calculate the data right now!"), - onClick = recalculate - ) + if (weightUntilOvertake < 0) { + if (weightPerSecond > 0) { + farmingChatMessage("You passed §b$nextName §ein the Farming Weight Leaderboard!") } - val timeFormat = if (weightPerSecond != -1.0) { - val timeTillOvertake = (weightUntilOvertake / weightPerSecond).minutes - val format = timeTillOvertake.format() - " §7(§b$format§7)" - } else "" - - val weightFormat = weightUntilOvertake.roundTo(2).addSeparators() - val text = "§e$weightFormat$timeFormat §7behind §b$nextName" - return if (showRankGoal) { - Renderable.string(text) + // Lower leaderboard position + if (leaderboardPosition == -1) { + leaderboardPosition = 10000 } else { - Renderable.clickAndHover( - text, - listOf("§eClick to open the Farming Profile of §b$nextName."), - onClick = { openWebsite(nextName) } - ) + leaderboardPosition-- } - } - - private fun resetData() { - apiError = false - // We ask both api endpoints after every world switch - weight = -1.0 - weightPerSecond = -1.0 + GardenAPI.storage?.farmingWeight?.lastFarmingWeightLeaderboard = + leaderboardPosition - leaderboardPosition = -1 - weightNeedsRecalculating = true - lastLeaderboardUpdate = SimpleTimeMark.farPast() + // Remove passed player to present the next one + nextPlayers.removeFirst() - nextPlayers.clear() - rankGoal = -1 + // Display waiting message if nextPlayers list is empty + // Update values to next player + nextName = nextPlayer.name + weightUntilOvertake = nextPlayer.weight - totalWeight + } - localCounter.clear() + if (nextPlayer.weight == 0.0) { + return Renderable.clickAndHover( + "§cRejoin the garden to show ETA!", + listOf("Click here to calculate the data right now!"), + onClick = recalculate + ) } - private fun farmingChatMessage(message: String) { - ChatUtils.hoverableChat( - message, - listOf( - "§eClick to open your Farming Weight", - "§eprofile on §celitebot.dev", - ), - "shfarmingprofile ${McPlayer.name}" + val timeFormat = if (weightPerSecond != -1.0) { + val timeTillOvertake = (weightUntilOvertake / weightPerSecond).minutes + val format = timeTillOvertake.format() + " §7(§b$format§7)" + } else "" + + val weightFormat = weightUntilOvertake.roundTo(2).addSeparators() + val text = "§e$weightFormat$timeFormat §7behind §b$nextName" + return if (showRankGoal) { + Renderable.string(text) + } else { + Renderable.clickAndHover( + text, + listOf("§eClick to open the Farming Profile of §b$nextName."), + onClick = { openWebsite(nextName) } ) } + } - private fun isEnabled() = ((OutsideSbFeature.FARMING_WEIGHT.isSelected() && !LorenzUtils.inSkyBlock) || - (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden))) && config.display + private fun resetData() { + apiError = false + // We ask both api endpoints after every world switch + weight = -1.0 + weightPerSecond = -1.0 + + leaderboardPosition = -1 + weightNeedsRecalculating = true + lastLeaderboardUpdate = SimpleTimeMark.farPast() - private fun isEtaEnabled() = config.overtakeETA + nextPlayers.clear() + rankGoal = -1 - fun addCrop(crop: CropType, addedCounter: Int) { - val before = getExactWeight() - localCounter[crop] = crop.getLocalCounter() + addedCounter - val after = getExactWeight() + localCounter.clear() + } - updateWeightPerSecond(crop, before, after, addedCounter) + private fun farmingChatMessage(message: String) { + ChatUtils.hoverableChat( + message, + listOf( + "§eClick to open your Farming Weight", + "§eprofile on §celitebot.dev", + ), + "shfarmingprofile ${McPlayer.name}" + ) + } - weightNeedsRecalculating = true - } + private fun isEnabled() = ((OutsideSbFeature.FARMING_WEIGHT.isSelected() && !LorenzUtils.inSkyBlock) || + (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden))) && config.display - private fun updateWeightPerSecond(crop: CropType, before: Double, after: Double, diff: Int) { - val speed = crop.getSpeed() ?: return - val weightDiff = (after - before) * 1000 - weightPerSecond = weightDiff / diff * speed / 1000 - } + private fun isEtaEnabled() = config.overtakeETA - private fun getExactWeight(): Double { - val values = calculateCollectionWeight().values - return if (values.isNotEmpty()) { - values.sum() - } else 0.0 - } + fun addCrop(crop: CropType, addedCounter: Int) { + val before = getExactWeight() + localCounter[crop] = crop.getLocalCounter() + addedCounter + val after = getExactWeight() - private fun loadLeaderboardIfAble() { - if (isLoadingLeaderboard) return - isLoadingLeaderboard = true + updateWeightPerSecond(crop, before, after, addedCounter) - SkyHanniMod.coroutineScope.launch { - val wasNotLoaded = leaderboardPosition == -1 - leaderboardPosition = loadLeaderboardPosition() - if (wasNotLoaded && config.showLbChange) { - checkOffScreenLeaderboardChanges() - } - GardenAPI.storage?.farmingWeight?.lastFarmingWeightLeaderboard = - leaderboardPosition - lastLeaderboardUpdate = SimpleTimeMark.now() - isLoadingLeaderboard = false - } - } + weightNeedsRecalculating = true + } - private fun checkOffScreenLeaderboardChanges() { - val profileSpecific = ProfileStorageData.profileSpecific ?: return - val oldPosition = profileSpecific.garden.farmingWeight.lastFarmingWeightLeaderboard + private fun updateWeightPerSecond(crop: CropType, before: Double, after: Double, diff: Int) { + val speed = crop.getSpeed() ?: return + val weightDiff = (after - before) * 1000 + weightPerSecond = weightDiff / diff * speed / 1000 + } - if (oldPosition <= 0) return - if (leaderboardPosition <= 0) return + private fun getExactWeight(): Double { + val values = calculateCollectionWeight().values + return if (values.isNotEmpty()) { + values.sum() + } else 0.0 + } - val diff = leaderboardPosition - oldPosition - if (diff == 0) return + private fun loadLeaderboardIfAble() { + if (isLoadingLeaderboard) return + isLoadingLeaderboard = true - if (diff > 0) { - showLbChange("§cdropped ${StringUtils.pluralize(diff, "place", withNumber = true)}", oldPosition) - } else { - showLbChange("§arisen ${StringUtils.pluralize(-diff, "place", withNumber = true)}", oldPosition) + SkyHanniMod.coroutineScope.launch { + val wasNotLoaded = leaderboardPosition == -1 + leaderboardPosition = loadLeaderboardPosition() + if (wasNotLoaded && config.showLbChange) { + checkOffScreenLeaderboardChanges() } + GardenAPI.storage?.farmingWeight?.lastFarmingWeightLeaderboard = + leaderboardPosition + lastLeaderboardUpdate = SimpleTimeMark.now() + isLoadingLeaderboard = false } + } - private fun showLbChange(direction: String, oldPosition: Int) { - farmingChatMessage( - "§7Since your last visit to the §aGarden§7, " + - "you have $direction §7on the §dFarming Leaderboard§7. " + - "§7(§e#${oldPosition.addSeparators()} §7-> §e#${leaderboardPosition.addSeparators()}§7)" - ) + private fun checkOffScreenLeaderboardChanges() { + val profileSpecific = ProfileStorageData.profileSpecific ?: return + val oldPosition = profileSpecific.garden.farmingWeight.lastFarmingWeightLeaderboard + + if (oldPosition <= 0) return + if (leaderboardPosition <= 0) return + + val diff = leaderboardPosition - oldPosition + if (diff == 0) return + + if (diff > 0) { + showLbChange("§cdropped ${StringUtils.pluralize(diff, "place", withNumber = true)}", oldPosition) + } else { + showLbChange("§arisen ${StringUtils.pluralize(-diff, "place", withNumber = true)}", oldPosition) } + } - private fun loadLeaderboardPosition(): Int { - val uuid = McPlayer.uuid.toDashlessUUID() + private fun showLbChange(direction: String, oldPosition: Int) { + farmingChatMessage( + "§7Since your last visit to the §aGarden§7, " + + "you have $direction §7on the §dFarming Leaderboard§7. " + + "§7(§e#${oldPosition.addSeparators()} §7-> §e#${leaderboardPosition.addSeparators()}§7)" + ) + } - val includeUpcoming = if (isEtaEnabled()) "?includeUpcoming=true" else "" - val goalRank = getRankGoal() + 1 // API returns upcoming players as if you were at this rank already - val atRank = if (isEtaEnabled() && goalRank != 10001) "&atRank=$goalRank" else "" + private fun loadLeaderboardPosition(): Int { + val uuid = McPlayer.uuid.toDashlessUUID() - val url = "https://api.elitebot.dev/leaderboard/rank/farmingweight/$uuid/$profileId$includeUpcoming$atRank" - val apiResponse = APIUtil.getJSONResponse(url) + val includeUpcoming = if (isEtaEnabled()) "?includeUpcoming=true" else "" + val goalRank = getRankGoal() + 1 // API returns upcoming players as if you were at this rank already + val atRank = if (isEtaEnabled() && goalRank != 10001) "&atRank=$goalRank" else "" - try { - val apiData = toEliteLeaderboardJson(apiResponse).data + val url = "https://api.elitebot.dev/leaderboard/rank/farmingweight/$uuid/$profileId$includeUpcoming$atRank" + val apiResponse = APIUtil.getJSONResponse(url) - if (isEtaEnabled()) { - nextPlayers.clear() - apiData.upcomingPlayers.forEach { nextPlayers.add(it) } - } + try { + val apiData = toEliteLeaderboardJson(apiResponse).data - return apiData.rank - } catch (e: Exception) { - ErrorManager.logErrorWithData( - e, "Error getting weight leaderboard position", - "url" to url, - "apiResponse" to apiResponse - ) + if (isEtaEnabled()) { + nextPlayers.clear() + apiData.upcomingPlayers.forEach { nextPlayers.add(it) } } - return -1 - } - private fun toEliteLeaderboardJson(obj: JsonObject): EliteLeaderboardJson { - val jsonObject = JsonObject() - jsonObject.add("data", obj) - return eliteWeightApiGson.fromJson(jsonObject) + return apiData.rank + } catch (e: Exception) { + ErrorManager.logErrorWithData( + e, "Error getting weight leaderboard position", + "url" to url, + "apiResponse" to apiResponse + ) } + return -1 + } - private fun loadWeight(localProfile: String) { - val url = "https://api.elitebot.dev/weight/${McPlayer.uuid.toDashlessUUID()}" - val apiResponse = APIUtil.getJSONResponse(url) + private fun toEliteLeaderboardJson(obj: JsonObject): EliteLeaderboardJson { + val jsonObject = JsonObject() + jsonObject.add("data", obj) + return eliteWeightApiGson.fromJson(jsonObject) + } - var error: Throwable? = null + private fun loadWeight(localProfile: String) { + val url = "https://api.elitebot.dev/weight/${McPlayer.uuid.toDashlessUUID()}" + val apiResponse = APIUtil.getJSONResponse(url) - try { + var error: Throwable? = null - val apiData = eliteWeightApiGson.fromJson(apiResponse) + try { - val selectedProfileId = apiData.selectedProfileId - var selectedProfileEntry = apiData.profiles.find { it.profileId == selectedProfileId } + val apiData = eliteWeightApiGson.fromJson(apiResponse) - if (selectedProfileEntry == null || (selectedProfileEntry.profileName.lowercase() != localProfile && localProfile != "")) { - selectedProfileEntry = apiData.profiles.find { it.profileName.lowercase() == localProfile } - } + val selectedProfileId = apiData.selectedProfileId + var selectedProfileEntry = apiData.profiles.find { it.profileId == selectedProfileId } - if (selectedProfileEntry != null) { - profileId = selectedProfileEntry.profileId - weight = selectedProfileEntry.totalWeight + if (selectedProfileEntry == null || (selectedProfileEntry.profileName.lowercase() != localProfile && localProfile != "")) { + selectedProfileEntry = apiData.profiles.find { it.profileName.lowercase() == localProfile } + } - localCounter.clear() - weightNeedsRecalculating = true - return - } + if (selectedProfileEntry != null) { + profileId = selectedProfileEntry.profileId + weight = selectedProfileEntry.totalWeight - } catch (e: Exception) { - error = e + localCounter.clear() + weightNeedsRecalculating = true + return } - apiError = true - ErrorManager.logErrorWithData( - error ?: IllegalStateException("Error loading user farming weight"), - "Error loading user farming weight\n" + - "§eLoading the farming weight data from elitebot.dev failed!\n" + - "§eYou can re-enter the garden to try to fix the problem.\n" + - "§cIf this message repeats, please report it on Discord!\n", - "url" to url, - "apiResponse" to apiResponse, - "localProfile" to localProfile - ) + } catch (e: Exception) { + error = e } + apiError = true + + ErrorManager.logErrorWithData( + error ?: IllegalStateException("Error loading user farming weight"), + "Error loading user farming weight\n" + + "§eLoading the farming weight data from elitebot.dev failed!\n" + + "§eYou can re-enter the garden to try to fix the problem.\n" + + "§cIf this message repeats, please report it on Discord!\n", + "url" to url, + "apiResponse" to apiResponse, + "localProfile" to localProfile + ) + } - private fun calculateCollectionWeight(): MutableMap { - val weightPerCrop = mutableMapOf() - var totalWeight = 0.0 - for (crop in CropType.entries) { - val weight = crop.getLocalCounter() / crop.getFactor() - weightPerCrop[crop] = weight - totalWeight += weight - } - if (totalWeight > 0) { - weightPerCrop[CropType.MUSHROOM] = specialMushroomWeight(weightPerCrop, totalWeight) - } - return weightPerCrop + private fun calculateCollectionWeight(): MutableMap { + val weightPerCrop = mutableMapOf() + var totalWeight = 0.0 + for (crop in CropType.entries) { + val weight = crop.getLocalCounter() / crop.getFactor() + weightPerCrop[crop] = weight + totalWeight += weight + } + if (totalWeight > 0) { + weightPerCrop[CropType.MUSHROOM] = specialMushroomWeight(weightPerCrop, totalWeight) } + return weightPerCrop + } - private fun specialMushroomWeight(weightPerCrop: MutableMap, totalWeight: Double): Double { - val cactusWeight = weightPerCrop[CropType.CACTUS]!! - val sugarCaneWeight = weightPerCrop[CropType.SUGAR_CANE]!! - val doubleBreakRatio = (cactusWeight + sugarCaneWeight) / totalWeight - val normalRatio = (totalWeight - cactusWeight - sugarCaneWeight) / totalWeight + private fun specialMushroomWeight(weightPerCrop: MutableMap, totalWeight: Double): Double { + val cactusWeight = weightPerCrop[CropType.CACTUS]!! + val sugarCaneWeight = weightPerCrop[CropType.SUGAR_CANE]!! + val doubleBreakRatio = (cactusWeight + sugarCaneWeight) / totalWeight + val normalRatio = (totalWeight - cactusWeight - sugarCaneWeight) / totalWeight - val mushroomFactor = CropType.MUSHROOM.getFactor() - val mushroomCollection = CropType.MUSHROOM.getLocalCounter() - return doubleBreakRatio * (mushroomCollection / (2 * mushroomFactor)) + normalRatio * (mushroomCollection / mushroomFactor) - } + val mushroomFactor = CropType.MUSHROOM.getFactor() + val mushroomCollection = CropType.MUSHROOM.getLocalCounter() + return doubleBreakRatio * (mushroomCollection / (2 * mushroomFactor)) + normalRatio * (mushroomCollection / mushroomFactor) + } - private fun CropType.getLocalCounter() = localCounter[this] ?: 0L + private fun CropType.getLocalCounter() = localCounter[this] ?: 0L - private fun CropType.getFactor(): Double { - return cropWeight[this] ?: backupCropWeights[this] ?: error("Crop $this not in backupFactors!") - } + private fun CropType.getFactor(): Double { + return cropWeight[this] ?: backupCropWeights[this] ?: error("Crop $this not in backupFactors!") + } - fun lookUpCommand(it: Array) { - val name = if (it.size == 1) it[0] else McPlayer.name - openWebsite(name, ignoreCooldown = true) - } + fun lookUpCommand(it: Array) { + val name = if (it.size == 1) it[0] else McPlayer.name + openWebsite(name, ignoreCooldown = true) + } - private var lastName = "" + private var lastName = "" - private fun openWebsite(name: String, ignoreCooldown: Boolean = false) { - if (!ignoreCooldown && lastOpenWebsite.passedSince() < 5.seconds && name == lastName) return - lastOpenWebsite = SimpleTimeMark.now() - lastName = name + private fun openWebsite(name: String, ignoreCooldown: Boolean = false) { + if (!ignoreCooldown && lastOpenWebsite.passedSince() < 5.seconds && name == lastName) return + lastOpenWebsite = SimpleTimeMark.now() + lastName = name - OS.openUrl("https://elitebot.dev/@$name/") - ChatUtils.chat("Opening Farming Profile of player §b$name") - } + OS.openUrl("https://elitebot.dev/@$name/") + ChatUtils.chat("Opening Farming Profile of player §b$name") + } - private val cropWeight = mutableMapOf() - private var attemptingCropWeightFetch = false - private var hasFetchedCropWeights = false - - private fun getCropWeights() { - if (attemptingCropWeightFetch || hasFetchedCropWeights) return - attemptingCropWeightFetch = true - val url = "https://api.elitebot.dev/weights/all" - val apiResponse = APIUtil.getJSONResponse(url) - - try { - val apiData = eliteWeightApiGson.fromJson(apiResponse) - apiData.crops - for (crop in apiData.crops) { - cropWeight[crop.key] = crop.value - } - hasFetchedCropWeights = true - } catch (e: Exception) { - ErrorManager.logErrorWithData( - e, "Error getting crop weights from elitebot.dev", - "apiResponse" to apiResponse - ) + private val cropWeight = mutableMapOf() + private var attemptingCropWeightFetch = false + private var hasFetchedCropWeights = false + + private fun getCropWeights() { + if (attemptingCropWeightFetch || hasFetchedCropWeights) return + attemptingCropWeightFetch = true + val url = "https://api.elitebot.dev/weights/all" + val apiResponse = APIUtil.getJSONResponse(url) + + try { + val apiData = eliteWeightApiGson.fromJson(apiResponse) + apiData.crops + for (crop in apiData.crops) { + cropWeight[crop.key] = crop.value } - } - - // still needed when first joining garden and if they cant make https requests - private val backupCropWeights by lazy { - mapOf( - CropType.WHEAT to 100_000.0, - CropType.CARROT to 302_061.86, - CropType.POTATO to 300_000.0, - CropType.SUGAR_CANE to 200_000.0, - CropType.NETHER_WART to 250_000.0, - CropType.PUMPKIN to 98_284.71, - CropType.MELON to 485_308.47, - CropType.MUSHROOM to 90_178.06, - CropType.COCOA_BEANS to 267_174.04, - CropType.CACTUS to 177_254.45, + hasFetchedCropWeights = true + } catch (e: Exception) { + ErrorManager.logErrorWithData( + e, "Error getting crop weights from elitebot.dev", + "apiResponse" to apiResponse ) } } + // still needed when first joining garden and if they cant make https requests + private val backupCropWeights by lazy { + mapOf( + CropType.WHEAT to 100_000.0, + CropType.CARROT to 302_061.86, + CropType.POTATO to 300_000.0, + CropType.SUGAR_CANE to 200_000.0, + CropType.NETHER_WART to 250_000.0, + CropType.PUMPKIN to 98_284.71, + CropType.MELON to 485_308.47, + CropType.MUSHROOM to 90_178.06, + CropType.COCOA_BEANS to 267_174.04, + CropType.CACTUS to 177_254.45, + ) + } + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(14, "garden.eliteFarmingWeight.offScreenDropMessage", "garden.eliteFarmingWeights.showLbChange") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt index 77f07255363b..72cc5a25b7f7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt @@ -19,41 +19,38 @@ import at.hannibal2.skyhanni.utils.datetime.TimeUtils.format import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds -class GardenBestCropTime { +object GardenBestCropTime { var display = emptyList>() - companion object { + private val config get() = GardenAPI.config.cropMilestones + val timeTillNextCrop = mutableMapOf() - private val config get() = GardenAPI.config.cropMilestones - val timeTillNextCrop = mutableMapOf() - - fun reset() { - timeTillNextCrop.clear() - updateTimeTillNextCrop() - } + fun reset() { + timeTillNextCrop.clear() + updateTimeTillNextCrop() + } - fun updateTimeTillNextCrop() { - val useOverflow = config.overflow.bestCropTime - for (crop in CropType.entries) { - val speed = crop.getSpeed() ?: continue - if (crop.isMaxed(useOverflow)) continue + fun updateTimeTillNextCrop() { + val useOverflow = config.overflow.bestCropTime + for (crop in CropType.entries) { + val speed = crop.getSpeed() ?: continue + if (crop.isMaxed(useOverflow)) continue - val counter = crop.getCounter() - val currentTier = GardenCropMilestones.getTierForCropCount(counter, crop, allowOverflow = true) + val counter = crop.getCounter() + val currentTier = GardenCropMilestones.getTierForCropCount(counter, crop, allowOverflow = true) - val cropsForCurrentTier = GardenCropMilestones.getCropsForTier(currentTier, crop) - val nextTier = if (config.bestShowMaxedNeeded.get()) 46 else currentTier + 1 - val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier, crop) + val cropsForCurrentTier = GardenCropMilestones.getCropsForTier(currentTier, crop) + val nextTier = if (config.bestShowMaxedNeeded.get()) 46 else currentTier + 1 + val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier, crop) - val have = counter - cropsForCurrentTier - val need = cropsForNextTier - cropsForCurrentTier + val have = counter - cropsForCurrentTier + val need = cropsForNextTier - cropsForCurrentTier - val missing = need - have - val missingTimeSeconds = missing / speed - val millis = missingTimeSeconds * 1000 - timeTillNextCrop[crop] = millis - } + val missing = need - have + val missingTimeSeconds = missing / speed + val millis = missingTimeSeconds * 1000 + timeTillNextCrop[crop] = millis } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBurrowingSporesNotifier.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBurrowingSporesNotifier.kt index 33036b52a398..37433ad70052 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBurrowingSporesNotifier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBurrowingSporesNotifier.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class GardenBurrowingSporesNotifier { +object GardenBurrowingSporesNotifier { @SubscribeEvent fun onChat(event: LorenzChatEvent) { @@ -15,8 +15,6 @@ class GardenBurrowingSporesNotifier { if (event.message.endsWith("§6§lVERY RARE CROP! §r§f§r§9Burrowing Spores")) { LorenzUtils.sendTitle("§9Burrowing Spores!", 5.seconds) - // would be sent too often, nothing special then -// ItemBlink.setBlink(NEUItems.getItemStackOrNull("BURROWING_SPORES"), 5_000) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index f971c752b7a2..badf477b58dc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -48,7 +48,6 @@ object GardenCropMilestoneDisplay { private val config get() = GardenAPI.config.cropMilestones private val overflowConfig get() = config.overflow private val storage get() = ProfileStorageData.profileSpecific?.garden?.customGoalMilestone - private val bestCropTime = GardenBestCropTime() private var lastPlaySoundTime = SimpleTimeMark.farPast() private var needsInventory = false @@ -86,7 +85,7 @@ object GardenCropMilestoneDisplay { } if (config.next.bestDisplay) { - config.next.displayPos.renderStringsAndItems(bestCropTime.display, posLabel = "Best Crop Time") + config.next.displayPos.renderStringsAndItems(GardenBestCropTime.display, posLabel = "Best Crop Time") } } @@ -137,14 +136,14 @@ object GardenCropMilestoneDisplay { fun update() { progressDisplay = emptyList() mushroomCowPerkDisplay = emptyList() - bestCropTime.display = emptyList() + GardenBestCropTime.display = emptyList() val currentCrop = GardenAPI.getCurrentlyFarmedCrop() currentCrop?.let { progressDisplay = drawProgressDisplay(it) } if (config.next.bestDisplay && config.next.bestAlwaysOn || currentCrop != null) { - bestCropTime.display = bestCropTime.drawBestDisplay(currentCrop) + GardenBestCropTime.display = GardenBestCropTime.drawBestDisplay(currentCrop) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt index 1e9eef21db5d..6330d508667f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt @@ -15,7 +15,7 @@ import at.hannibal2.skyhanni.utils.mc.McSound.play import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class WildStrawberryDyeNotification { +object WildStrawberryDyeNotification { private var lastCloseTime = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt index eb61188da843..0856568ca23b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt @@ -14,7 +14,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class WrongFungiCutterWarning { +object WrongFungiCutterWarning { private var mode = FungiMode.UNKNOWN private var lastPlaySoundTime = 0L diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt index 6d0fec750e7d..ee17ccc43c66 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.garden.fortuneguide import at.hannibal2.skyhanni.data.CropAccessoryData -import at.hannibal2.skyhanni.data.GardenCropUpgrades.Companion.getUpgradeLevel +import at.hannibal2.skyhanni.data.GardenCropUpgrades.getUpgradeLevel import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt index d7b12a3ca09a..963b221e797c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt @@ -16,7 +16,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class AnitaExtraFarmingFortune { +object AnitaExtraFarmingFortune { private val config get() = GardenAPI.config.anitaShop diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt index f1b045127c98..9a0ae98d7d5a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt @@ -16,7 +16,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.roundTo import at.hannibal2.skyhanni.utils.StringUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GardenCropMilestoneInventory { +object GardenCropMilestoneInventory { private var average = -1.0 private val config get() = GardenAPI.config diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt index fa6a2592012e..ee9924734d7e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GardenInventoryNumbers { +object GardenInventoryNumbers { private val config get() = GardenAPI.config.number diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryTooltipOverflow.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryTooltipOverflow.kt index b4f76c9f2bc8..11807fc42c4e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryTooltipOverflow.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryTooltipOverflow.kt @@ -17,7 +17,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent // TODO: Merge common code with skill overflow -class GardenInventoryTooltipOverflow { +object GardenInventoryTooltipOverflow { private val config get() = SkyHanniMod.feature.garden.cropMilestones.overflow diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/LogBookStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/LogBookStats.kt index 019eea299d66..ba7da3a784a1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/LogBookStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/LogBookStats.kt @@ -18,7 +18,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.init.Items import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class LogBookStats { +object LogBookStats { private val groupPattern = RepoPattern.group("garden.inventory.logbook") private val visitedPattern by groupPattern.pattern( diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt index 09b85ef29454..d40535cd67e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt @@ -25,7 +25,7 @@ import com.google.gson.JsonPrimitive import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SkyMartCopperPrice { +object SkyMartCopperPrice { private val copperPattern by RepoPattern.pattern( "garden.inventory.skymart.copper", @@ -35,10 +35,7 @@ class SkyMartCopperPrice { private var display = emptyList() private val config get() = GardenAPI.config.skyMart - companion object { - - var inInventory = false - } + var inInventory = false private fun ItemStack.loreCosts(): MutableList { var found = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenNextPlotPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenNextPlotPrice.kt index 1391f5706174..c27f46d2b1de 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenNextPlotPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenNextPlotPrice.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NumberUtil import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GardenNextPlotPrice { +object GardenNextPlotPrice { @SubscribeEvent fun onTooltip(event: LorenzToolTipEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt index 6cc02cf1bad7..f00661729bbe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.RenderUtils.highlight import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GardenPlotMenuHighlighting { +object GardenPlotMenuHighlighting { private val config get() = GardenAPI.config.plotMenuHighlighting diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt index 1c965465a8d6..22e96a38a4e1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt @@ -32,7 +32,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class PestFinder { +object PestFinder { private val config get() = PestAPI.config.pestFinder diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleLine.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleLine.kt index 581e6b2c6aa6..9024a97eae53 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleLine.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleLine.kt @@ -23,7 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds // TODO remove this workaround once PestParticleWaypoint does work again -class PestParticleLine { +object PestParticleLine { private val config get() = SkyHanniMod.feature.garden.pests.pestWaypoint class ParticleLocation(val location: LorenzVec, val spawnTime: SimpleTimeMark) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt index 81cf5a5f136f..d2a2f0b52323 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt @@ -29,7 +29,7 @@ import kotlin.math.absoluteValue import kotlin.time.Duration.Companion.seconds // TODO delete workaround class PestParticleLine when this class works again -class PestParticleWaypoint { +object PestParticleWaypoint { private val config get() = SkyHanniMod.feature.garden.pests.pestWaypoint diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt index acf23f51bb7f..a86ceba4620c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt @@ -17,7 +17,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class PestSpawn { +object PestSpawn { private val config get() = PestAPI.config.pestSpawn diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayDisplay.kt index e5b8559610ca..688e3ca700a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayDisplay.kt @@ -20,7 +20,7 @@ import at.hannibal2.skyhanni.utils.datetime.TimeUtils.format import at.hannibal2.skyhanni.utils.datetime.TimeUtils.timerColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SprayDisplay { +object SprayDisplay { private val config get() = PestAPI.config.spray private var display: String? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayFeatures.kt index 269f9661c0b4..5997afc46ada 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/SprayFeatures.kt @@ -18,7 +18,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class SprayFeatures { +object SprayFeatures { private val config get() = PestAPI.config.spray diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/StereoHarmonyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/StereoHarmonyDisplay.kt index ec03ab4a2aca..e44aa51739d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/StereoHarmonyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/StereoHarmonyDisplay.kt @@ -17,7 +17,7 @@ import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class StereoHarmonyDisplay { +object StereoHarmonyDisplay { private val config get() = PestAPI.config.stereoHarmony diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt index 709b486abaa0..36e6427b7571 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt @@ -22,7 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class GardenVisitorSupercraft { +object GardenVisitorSupercraft { private val isSupercraftEnabled get() = VisitorAPI.config.shoppingList.showSuperCraft diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt index 426fbf94960b..55ae642aed83 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt @@ -29,7 +29,7 @@ import kotlin.time.Duration.Companion.seconds import kotlin.time.DurationUnit import kotlin.time.toDuration -class GardenVisitorTimer { +object GardenVisitorTimer { private val config get() = GardenAPI.config.visitors.timer @@ -46,6 +46,8 @@ class GardenVisitorTimer { private var lastTimerValue = "" private var lastTimerUpdate = SimpleTimeMark.farPast() + private var lastVisitors: Int = -1 + // TODO nea? // private val visitorInterval by dynamic(GardenAPI::config, Storage.ProfileSpecific.GardenStorage::visitorInterval) private var visitorInterval: Duration? @@ -56,11 +58,6 @@ class GardenVisitorTimer { } } - companion object { - - var lastVisitors: Int = -1 - } - @SubscribeEvent fun onVisitorArrival(event: VisitorArrivalEvent) { visitorJustArrived = true diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt index 5453ddd514e2..637b9472a9d9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt @@ -24,7 +24,7 @@ import net.minecraft.entity.player.EntityPlayer import net.minecraft.network.play.client.C02PacketUseEntity import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class HighlightVisitorsOutsideOfGarden { +object HighlightVisitorsOutsideOfGarden { private var visitorJson = mapOf>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt index 5dc76b5fb647..6f87e3e41441 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt @@ -36,7 +36,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class VisitorListener { +object VisitorListener { private val offersAcceptedPattern by RepoPattern.pattern( "garden.visitor.offersaccepted", "§7Offers Accepted: §a(?\\d+)" @@ -46,12 +46,6 @@ class VisitorListener { private val logger = LorenzLogger("garden/visitors/listener") - companion object { - private val VISITOR_INFO_ITEM_SLOT = 13 - private val VISITOR_ACCEPT_ITEM_SLOT = 29 - private val VISITOR_REFUSE_ITEM_SLOT = 33 - } - @SubscribeEvent fun onProfileJoin(event: ProfileJoinEvent) { VisitorAPI.reset() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt index 75d0af8bbb8e..ad2a20d93251 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt @@ -23,7 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.math.absoluteValue import kotlin.time.Duration.Companion.seconds -class VisitorRewardWarning { +object VisitorRewardWarning { private val config get() = VisitorAPI.config.rewardWarning @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt index a55cf8b6564d..3d4e6daadf76 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt @@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.data.GuiEditManager -import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsX -import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY -import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getDummySize +import at.hannibal2.skyhanni.data.GuiEditManager.getAbsX +import at.hannibal2.skyhanni.data.GuiEditManager.getAbsY +import at.hannibal2.skyhanni.data.GuiEditManager.getDummySize import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.RenderUtils import io.github.moulberry.notenoughupdates.util.Utils diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverDisplay.kt index 608b66b2bdd8..7fff857394d4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverDisplay.kt @@ -22,7 +22,7 @@ import net.minecraft.init.Items import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class QuiverDisplay { +object QuiverDisplay { private val config get() = SkyHanniMod.feature.combat.quiverConfig.quiverDisplay diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverWarning.kt index 59fd5e51d725..92be5a86182b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverWarning.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class QuiverWarning { +object QuiverWarning { private val config get() = SkyHanniMod.feature.combat.quiverConfig diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt index 5bd6767a11c5..344be061c71d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt @@ -32,7 +32,7 @@ import net.minecraft.init.Items import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ChestValue { +object ChestValue { private val config get() = SkyHanniMod.feature.inventory.chestValueConfig private var display = emptyList>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/DojoRankDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/DojoRankDisplay.kt index 85000714e86f..60a141b5cb35 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/DojoRankDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/DojoRankDisplay.kt @@ -18,7 +18,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class DojoRankDisplay { +object DojoRankDisplay { private val config get() = SkyHanniMod.feature.crimsonIsle private var display = emptyList() diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index 64fe2f2aa20b..de6e3afb5525 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -48,7 +48,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class HideNotClickableItems { +object HideNotClickableItems { private val config get() = SkyHanniMod.feature.inventory.hideNotClickable diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt index b4d57c3c8074..3eff0582264e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt @@ -14,15 +14,13 @@ import java.awt.Color import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds import kotlin.time.DurationUnit -import kotlin.time.ExperimentalTime import kotlin.time.TimeMark import kotlin.time.TimeSource /** * @author Linnea Gräf */ -@OptIn(ExperimentalTime::class) -class HighlightBonzoMasks { +object HighlightBonzoMasks { private val config get() = SkyHanniMod.feature.inventory.itemAbilities @@ -52,6 +50,7 @@ class HighlightBonzoMasks { } } + // TODO wtffffffffffffffffffffffffffffffffffffffffffffffffffffff private fun maskType(item: ItemStack): String? { return when (item.getInternalName().asString()) { "STARRED_BONZO_MASK" -> "BONZO_MASK" @@ -77,15 +76,12 @@ class HighlightBonzoMasks { maskTimers.clear() } - companion object { - data class CooldownTimer(val timeMark: TimeMark, val duration: Duration) { + data class CooldownTimer(val timeMark: TimeMark, val duration: Duration) { - val percentComplete: Double - get() = - timeMark.elapsedNow().toDouble(DurationUnit.SECONDS) / duration.toDouble(DurationUnit.SECONDS) + val percentComplete: Double + get() = timeMark.elapsedNow().toDouble(DurationUnit.SECONDS) / duration.toDouble(DurationUnit.SECONDS) - val isActive: Boolean get() = timeMark.elapsedNow() < duration - } + val isActive: Boolean get() = timeMark.elapsedNow() < duration } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt index 20805e2e6fc8..482ceb2a2b6c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt @@ -14,7 +14,7 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ItemStars { +object ItemStars { private val config get() = SkyHanniMod.feature.inventory diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/MaxPurseItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/MaxPurseItems.kt index 9b2a51f4bc4e..099672f1e569 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/MaxPurseItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/MaxPurseItems.kt @@ -15,7 +15,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class MaxPurseItems { +object MaxPurseItems { private val config get() = SkyHanniMod.feature.inventory.bazaar private val patternGroup = RepoPattern.group("inventory.maxpurse") diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt index 8401b7f300c7..9cd782f7e235 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt @@ -17,7 +17,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RenderUtils.highlight import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class PowerStoneGuideFeatures { +object PowerStoneGuideFeatures { private var missing = mutableMapOf() private var inInventory = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt index a1fb4a359fd0..d0c66f97d216 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt @@ -18,7 +18,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class QuickCraftFeatures { +object QuickCraftFeatures { private val config get() = SkyHanniMod.feature.inventory private val quickCraftSlots = listOf(16, 25, 34) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt index 62482702098c..df4bf53b16a6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt @@ -15,7 +15,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class RngMeterInventory { +object RngMeterInventory { private val config get() = SkyHanniMod.feature.inventory.rngMeter diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickBrewing.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickBrewing.kt index 0e7337bc0cbe..61b615ddc6d9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickBrewing.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickBrewing.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.makeShiftClick import net.minecraft.client.gui.inventory.GuiChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ShiftClickBrewing { +object ShiftClickBrewing { @SubscribeEvent fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt index 4f9b08b20523..ac4812d569ac 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.makeShiftClick import net.minecraft.client.gui.inventory.GuiChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ShiftClickEquipment { +object ShiftClickEquipment { @SubscribeEvent fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt index 9ba07ae58406..ca0f1a5a2af7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt @@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class StatsTuning { +object StatsTuning { private val config get() = SkyHanniMod.feature.inventory.statsTuning diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarApi.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarApi.kt index d3714d623c7a..781f057cc416 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarApi.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarApi.kt @@ -8,7 +8,6 @@ import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.HypixelCommands @@ -31,40 +30,33 @@ import net.minecraft.inventory.ContainerChest import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class BazaarApi { +object BazaarApi { + var inBazaarInventory = false + private var currentSearchedItem = "" - private var loadedNpcPriceData = false + var currentlyOpenedProduct: NEUInternalName? = null - companion object { + fun NEUInternalName.getBazaarData(): BazaarData? = HypixelBazaarFetcher.latestProductInformation[this] - val holder = BazaarDataHolder() - var inBazaarInventory = false - private var currentSearchedItem = "" - - var currentlyOpenedProduct: NEUInternalName? = null - - fun NEUInternalName.getBazaarData(): BazaarData? = HypixelBazaarFetcher.latestProductInformation[this] - - fun NEUInternalName.getBazaarDataOrError(): BazaarData = getBazaarData() ?: run { - ErrorManager.skyHanniError( - "Can not find bazaar data for $itemName", - "internal name" to this - ) - } + fun NEUInternalName.getBazaarDataOrError(): BazaarData = getBazaarData() ?: run { + ErrorManager.skyHanniError( + "Can not find bazaar data for $itemName", + "internal name" to this + ) + } - fun isBazaarItem(stack: ItemStack): Boolean = stack.getInternalName().isBazaarItem() + fun isBazaarItem(stack: ItemStack): Boolean = stack.getInternalName().isBazaarItem() - fun NEUInternalName.isBazaarItem() = getBazaarData() != null + fun NEUInternalName.isBazaarItem() = getBazaarData() != null - fun searchForBazaarItem(displayName: String, amount: Int = -1) { - if (!LorenzUtils.inSkyBlock) return - if (NEUItems.neuHasFocus()) return - if (LorenzUtils.noTradeMode) return - if (DungeonAPI.inDungeon() || LorenzUtils.inKuudraFight) return - HypixelCommands.bazaar(displayName.removeColor()) - if (amount != -1) OS.copyToClipboard(amount.toString()) - currentSearchedItem = displayName.removeColor() - } + fun searchForBazaarItem(displayName: String, amount: Int = -1) { + if (!LorenzUtils.inSkyBlock) return + if (NEUItems.neuHasFocus()) return + if (LorenzUtils.noTradeMode) return + if (DungeonAPI.inDungeon() || LorenzUtils.inKuudraFight) return + HypixelCommands.bazaar(displayName.removeColor()) + if (amount != -1) OS.copyToClipboard(amount.toString()) + currentSearchedItem = displayName.removeColor() } @SubscribeEvent @@ -86,15 +78,6 @@ class BazaarApi { return NEUInternalName.fromItemName(bazaarItem.displayName) } - @SubscribeEvent - fun onTick(event: LorenzTickEvent) { - - if (!loadedNpcPriceData) { - loadedNpcPriceData = true - holder.start() - } - } - @SubscribeEvent fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { if (!LorenzUtils.inSkyBlock) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt index a29e843749c3..701f3a64d96f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.events.BazaarOpenedProductEvent import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent -import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.getBazaarDataOrError +import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.getBazaarDataOrError import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.LorenzUtils @@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class BazaarBestSellMethod { +object BazaarBestSellMethod { private val config get() = SkyHanniMod.feature.inventory.bazaar private var display = "" diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarCancelledBuyOrderClipboard.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarCancelledBuyOrderClipboard.kt index 02ec432d98a8..51b628f4c198 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarCancelledBuyOrderClipboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarCancelledBuyOrderClipboard.kt @@ -17,7 +17,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.system.OS import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class BazaarCancelledBuyOrderClipboard { +object BazaarCancelledBuyOrderClipboard { private val patternGroup = RepoPattern.group("bazaar.cancelledorder") diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarDataHolder.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarDataHolder.kt index 8911e1e2b156..8ecc486c8639 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarDataHolder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarDataHolder.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.inventory.bazaar import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.jsonobjects.other.SkyblockItemsDataJson +import at.hannibal2.skyhanni.events.HypixelJoinEvent import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.APIUtil @@ -10,14 +11,19 @@ import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.fromJson import kotlinx.coroutines.launch +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class BazaarDataHolder { +object BazaarDataHolder { - companion object { + private var npcPrices = mapOf() - private var npcPrices = mapOf() + fun getNpcPrice(internalName: NEUInternalName) = npcPrices[internalName] - fun getNpcPrice(internalName: NEUInternalName) = npcPrices[internalName] + @SubscribeEvent + fun onHypixelJoin(event: HypixelJoinEvent) { + SkyHanniMod.coroutineScope.launch { + npcPrices = loadNpcPrices() + } } private fun loadNpcPrices(): MutableMap { @@ -41,13 +47,4 @@ class BazaarDataHolder { } return list } - - fun start() { - SkyHanniMod.coroutineScope.launch { - npcPrices = loadNpcPrices() - } - - // TODO use SecondPassedEvent - } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOpenPriceWebsite.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOpenPriceWebsite.kt index e9821e441b53..7c8ac2cbaebd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOpenPriceWebsite.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOpenPriceWebsite.kt @@ -14,7 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class BazaarOpenPriceWebsite { +object BazaarOpenPriceWebsite { private val config get() = SkyHanniMod.feature.inventory.bazaar private var lastClick = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt index 557b4c48d055..1a89c202a904 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.inventory.bazaar import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiContainerEvent -import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.getBazaarDataOrError +import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.getBazaarDataOrError import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.InventoryUtils.getUpperItems import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -19,7 +19,7 @@ import net.minecraft.inventory.ContainerChest import net.minecraft.inventory.Slot import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class BazaarOrderHelper { +object BazaarOrderHelper { private val patternGroup = RepoPattern.group("bazaar.orderhelper") private val bazaarItemNamePattern by patternGroup.pattern( "itemname", @@ -34,13 +34,10 @@ class BazaarOrderHelper { "§7Price per unit: §6(?.*) coins" ) - companion object { - - fun isBazaarOrderInventory(inventoryName: String): Boolean = when (inventoryName) { - "Your Bazaar Orders" -> true - "Co-op Bazaar Orders" -> true - else -> false - } + fun isBazaarOrderInventory(inventoryName: String): Boolean = when (inventoryName) { + "Your Bazaar Orders" -> true + "Co-op Bazaar Orders" -> true + else -> false } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt index c1b4582c9201..da524e681ab8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent -import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.isBazaarItem +import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.isBazaarItem import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.ItemUtils.itemNameWithoutColor @@ -22,7 +22,7 @@ import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class CraftMaterialsFromBazaar { +object CraftMaterialsFromBazaar { private val config get() = SkyHanniMod.feature.inventory.bazaar diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryShortcut.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryShortcut.kt index d3bb031b2a0d..29f41ca04553 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryShortcut.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryShortcut.kt @@ -14,7 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class ChocolateFactoryShortcut { +object ChocolateFactoryShortcut { private val config get() = ChocolateFactoryAPI.config private var showItem = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayHelper.kt index 62d9bc166cc1..c55c016819c6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayHelper.kt @@ -15,7 +15,7 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes -class TiaRelayHelper { +object TiaRelayHelper { private val config get() = SkyHanniMod.feature.inventory.helper.tiaRelay private var inInventory = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt index 4e7730b03a69..debe4878e16f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class TiaRelayWaypoints { +object TiaRelayWaypoints { private val config get() = SkyHanniMod.feature.inventory.helper.tiaRelay private var waypoint: LorenzVec? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt index 6c22f31d91a5..3dd6a655733a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt @@ -15,21 +15,19 @@ import at.hannibal2.skyhanni.utils.mc.McPlayer import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class ChickenHeadTimer { +object ChickenHeadTimer { private val config get() = SkyHanniMod.feature.inventory.itemAbilities.chickenHead private var hasChickenHead = false private var lastTime = SimpleTimeMark.farPast() private val cooldown = 5.seconds - private val chickenHead = SkyhanniItems.CHICKEN_HEAD() - @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return if (!event.isMod(5)) return - hasChickenHead = McPlayer.helmet?.getInternalName() == chickenHead + hasChickenHead = McPlayer.helmet?.getInternalName() == SkyhanniItems.CHICKEN_HEAD() } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt index 6327f46660ff..704b34222f8a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt @@ -20,7 +20,7 @@ import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class FireVeilWandParticles { +object FireVeilWandParticles { private val config get() = SkyHanniMod.feature.inventory.itemAbilities.fireVeilWands diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index 5a11873f0b63..4576c359c99e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -36,7 +36,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.math.max -class ItemAbilityCooldown { +object ItemAbilityCooldown { private val config get() = SkyHanniMod.feature.inventory.itemAbilities diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/ColdOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/ColdOverlay.kt index f29337b12cbe..fe50f7ab7a9a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/ColdOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/ColdOverlay.kt @@ -15,7 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.opengl.GL11 import kotlin.time.Duration.Companion.seconds -class ColdOverlay { +object ColdOverlay { private val config get() = SkyHanniMod.feature.mining.coldOverlay diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt index 6d1eb25e3e62..690c2eb6f456 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt @@ -25,7 +25,7 @@ import net.minecraft.client.player.inventory.ContainerLocalMenu import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class DeepCavernsGuide { +object DeepCavernsGuide { private val config get() = SkyHanniMod.feature.mining.deepCavernsGuide diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/GoldenGoblinHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/GoldenGoblinHighlight.kt index f471bb282382..b1a20c54e979 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/GoldenGoblinHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/GoldenGoblinHighlight.kt @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class GoldenGoblinHighlight { +object GoldenGoblinHighlight { private val config get() = SkyHanniMod.feature.mining.highlightYourGoldenGoblin diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt index 31326c7e2c32..75b47bbfcaf9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt @@ -19,7 +19,7 @@ import net.minecraft.entity.monster.EntityMagmaCube import net.minecraft.entity.monster.EntitySlime import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class HighlightMiningCommissionMobs { +object HighlightMiningCommissionMobs { private val config get() = SkyHanniMod.feature.mining // TODO Commissin API diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt index c2d41acf38f6..1f977bef9c6d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt @@ -49,7 +49,7 @@ import java.awt.Color import kotlin.math.roundToInt import kotlin.time.Duration.Companion.seconds -class TunnelsMaps { +object TunnelsMaps { private val config get() = SkyHanniMod.feature.mining.tunnelMaps diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt index 80b9790878fd..6a2753fa98d5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class CrystalHollowsNamesInCore { +object CrystalHollowsNamesInCore { private val config get() = SkyHanniMod.feature.mining private val coreLocations = mapOf( diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt index eb5d9d11cb72..7eef1ca4ef31 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt @@ -12,7 +12,7 @@ import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color -class CrystalHollowsWalls { +object CrystalHollowsWalls { private val config get() = SkyHanniMod.feature.mining.crystalHollowsAreaWalls @@ -28,58 +28,58 @@ class CrystalHollowsWalls { ; } - private val expandTimes = 20 + private const val EXPAND_TIMES = 20 - private val heatHeight = 64.0 - private val maxHeight = 190.0 + private const val HEAT_HEIGHT = 64.0 + private const val MAX_HEIGHT = 190.0 - private val minX = 0.0 - private val middleX = 513.0 - private val maxX = 1024.0 + private const val MIN_X = 0.0 + private const val MIDDLE_X = 513.0 + private const val MAX_X = 1024.0 - private val minZ = 0.0 - private val middleZ = 513.0 - private val maxZ = 1024.0 + private const val MIN_Z = 0.0 + private const val MIDDLE_Z = 513.0 + private const val MAX_Z = 1024.0 private val yViewOffset get() = -Minecraft.getMinecraft().thePlayer.getEyeHeight().toDouble() // Yes Hypixel has misaligned the nucleus private val nucleusBB = BoundingBox( - 463.0, heatHeight, 460.0, - 560.0, maxHeight, 563.0 + 463.0, HEAT_HEIGHT, 460.0, + 560.0, MAX_HEIGHT, 563.0 ) - private val nucleusBBInflate = nucleusBB.expand(LorenzVec.expandVector * -expandTimes) - private val nucleusBBExpand = nucleusBB.expand(LorenzVec.expandVector * expandTimes) + private val nucleusBBInflate = nucleusBB.expand(LorenzVec.expandVector * -EXPAND_TIMES) + private val nucleusBBExpand = nucleusBB.expand(LorenzVec.expandVector * EXPAND_TIMES) private val nucleusBBOffsetY get() = nucleusBB.move(0.0, yViewOffset, 0.0) - private fun Double.shiftPX() = this + LorenzVec.expandVector.x * expandTimes - private fun Double.shiftNX() = this - LorenzVec.expandVector.x * expandTimes + private fun Double.shiftPX() = this + LorenzVec.expandVector.x * EXPAND_TIMES + private fun Double.shiftNX() = this - LorenzVec.expandVector.x * EXPAND_TIMES - private fun Double.shiftPY() = this + LorenzVec.expandVector.y * expandTimes - private fun Double.shiftNY() = this - LorenzVec.expandVector.y * expandTimes + private fun Double.shiftPY() = this + LorenzVec.expandVector.y * EXPAND_TIMES + private fun Double.shiftNY() = this - LorenzVec.expandVector.y * EXPAND_TIMES - private fun Double.shiftPZ() = this + LorenzVec.expandVector.z * expandTimes - private fun Double.shiftNZ() = this - LorenzVec.expandVector.z * expandTimes + private fun Double.shiftPZ() = this + LorenzVec.expandVector.z * EXPAND_TIMES + private fun Double.shiftNZ() = this - LorenzVec.expandVector.z * EXPAND_TIMES @SubscribeEvent fun onRender(event: LorenzRenderWorldEvent) { if (!isEnabled()) return val position = RenderUtils.getViewerPos(event.partialTicks) - if (position.y < heatHeight + yViewOffset) { + if (position.y < HEAT_HEIGHT + yViewOffset) { drawHeat(event) } else if (nucleusBBOffsetY.contains(position)) { if (!config.nucleus) return drawNucleus(event) - } else if (position.x > middleX) { - if (position.z > middleZ) { + } else if (position.x > MIDDLE_X) { + if (position.z > MIDDLE_Z) { drawPrecursor(event) } else { drawMithril((event)) } } else { - if (position.z > middleZ) { + if (position.z > MIDDLE_Z) { drawGoblin(event) } else { drawJungle(event) @@ -104,7 +104,7 @@ class CrystalHollowsWalls { } private fun drawHeat(event: LorenzRenderWorldEvent) = RenderUtils.QuadDrawer.draw3D(event.partialTicks) { - val heatHeight = heatHeight.shiftNY() + val heatHeight = HEAT_HEIGHT.shiftNY() draw( LorenzVec(nucleusBB.minX, heatHeight, nucleusBB.minZ), LorenzVec(nucleusBB.maxX, heatHeight, nucleusBB.minZ), @@ -132,49 +132,49 @@ class CrystalHollowsWalls { draw( southEastB, southEastT, - LorenzVec(nucleusBBInflate.minX, nucleusBBInflate.minY, middleZ), + LorenzVec(nucleusBBInflate.minX, nucleusBBInflate.minY, MIDDLE_Z), Areas.JUNGLE.color ) draw( southEastB, southEastT, - LorenzVec(middleX, nucleusBBInflate.minY, nucleusBBInflate.minZ), + LorenzVec(MIDDLE_X, nucleusBBInflate.minY, nucleusBBInflate.minZ), Areas.JUNGLE.color ) draw( northWestB, northWestT, - LorenzVec(nucleusBBInflate.maxX, nucleusBBInflate.minY, middleZ), + LorenzVec(nucleusBBInflate.maxX, nucleusBBInflate.minY, MIDDLE_Z), Areas.PRECURSOR.color ) draw( northWestB, northWestT, - LorenzVec(middleX, nucleusBBInflate.minY, nucleusBBInflate.maxZ), + LorenzVec(MIDDLE_X, nucleusBBInflate.minY, nucleusBBInflate.maxZ), Areas.PRECURSOR.color ) draw( southWestB, southWestT, - LorenzVec(nucleusBBInflate.minX, nucleusBBInflate.minY, middleZ), + LorenzVec(nucleusBBInflate.minX, nucleusBBInflate.minY, MIDDLE_Z), Areas.GOBLIN.color, ) draw( southWestB, southWestT, - LorenzVec(middleX, nucleusBBInflate.minY, nucleusBBInflate.maxZ), + LorenzVec(MIDDLE_X, nucleusBBInflate.minY, nucleusBBInflate.maxZ), Areas.GOBLIN.color ) draw( northEastB, northEastT, - LorenzVec(nucleusBBInflate.maxX, nucleusBBInflate.minY, middleZ), + LorenzVec(nucleusBBInflate.maxX, nucleusBBInflate.minY, MIDDLE_Z), Areas.MITHRIL.color ) draw( northEastB, northEastT, - LorenzVec(middleX, nucleusBBInflate.minY, nucleusBBInflate.minZ), + LorenzVec(MIDDLE_X, nucleusBBInflate.minY, nucleusBBInflate.minZ), Areas.MITHRIL.color ) } @@ -187,14 +187,14 @@ class CrystalHollowsWalls { color2: Color, ) { val nucleusX = if (isMinXEsleMaxX) nucleusBBExpand.minX else nucleusBBExpand.maxX - val middleX = if (isMinXEsleMaxX) middleX.shiftNX() else middleX.shiftPX() - val x = if (isMinXEsleMaxX) minX else maxX + val middleX = if (isMinXEsleMaxX) MIDDLE_X.shiftNX() else MIDDLE_X.shiftPX() + val x = if (isMinXEsleMaxX) MIN_X else MAX_X val nucleusZ = if (isMinZElseMaxZ) nucleusBBExpand.minZ else nucleusBBExpand.maxZ - val middleZ = if (isMinZElseMaxZ) middleZ.shiftNZ() else middleZ.shiftPZ() - val z = if (isMinZElseMaxZ) minZ else maxZ + val middleZ = if (isMinZElseMaxZ) MIDDLE_Z.shiftNZ() else MIDDLE_Z.shiftPZ() + val z = if (isMinZElseMaxZ) MIN_Z else MAX_Z - val heatHeight = heatHeight.shiftPY() + val heatHeight = HEAT_HEIGHT.shiftPY() val nucleusBase = LorenzVec(nucleusX, heatHeight, nucleusZ) @@ -213,26 +213,26 @@ class CrystalHollowsWalls { ) draw( nucleusXSideBase, - LorenzVec(nucleusX, maxHeight, middleZ), + LorenzVec(nucleusX, MAX_HEIGHT, middleZ), LorenzVec(x, heatHeight, middleZ), color1, ) draw( nucleusZSideBase, - LorenzVec(middleX, maxHeight, nucleusZ), + LorenzVec(middleX, MAX_HEIGHT, nucleusZ), LorenzVec(middleX, heatHeight, z), color2, ) draw( nucleusXSideBase, nucleusBase, - LorenzVec(nucleusX, maxHeight, middleZ), + LorenzVec(nucleusX, MAX_HEIGHT, middleZ), Areas.NUCLEUS.color, ) draw( nucleusZSideBase, nucleusBase, - LorenzVec(middleX, maxHeight, nucleusZ), + LorenzVec(middleX, MAX_HEIGHT, nucleusZ), Areas.NUCLEUS.color, ) } @@ -246,11 +246,11 @@ class CrystalHollowsWalls { color, heatHeight, nucleusX = if (isMinXEsleMaxX) nucleusBB.minX else nucleusBB.maxX, - middleX = if (isMinXEsleMaxX) middleX else middleX, - x = if (isMinXEsleMaxX) minX else maxX, + middleX = if (isMinXEsleMaxX) MIDDLE_X else MIDDLE_X, + x = if (isMinXEsleMaxX) MIN_X else MAX_X, nucleusZ = if (isMinZElseMaxZ) nucleusBB.minZ else nucleusBB.maxZ, - middleZ = if (isMinZElseMaxZ) middleX else middleX, - z = if (isMinZElseMaxZ) minZ else maxZ, + middleZ = if (isMinZElseMaxZ) MIDDLE_X else MIDDLE_X, + z = if (isMinZElseMaxZ) MIN_Z else MAX_Z, ) private fun RenderUtils.QuadDrawer.drawHeatArea( diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt index 9e5aa8dd08f9..8bef77eb69cb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.features.mining.eventtracker import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.BossbarAPI import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator -import at.hannibal2.skyhanni.api.BossbarAPI import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.BossbarUpdateEvent @@ -31,7 +31,7 @@ import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds -class MiningEventTracker { +object MiningEventTracker { private val config get() = SkyHanniMod.feature.mining.miningEvent private val patternGroup = RepoPattern.group("mining.eventtracker") @@ -61,11 +61,9 @@ class MiningEventTracker { private var canRequestAt = SimpleTimeMark.farPast() - companion object { - var apiErrorCount = 0 + var apiErrorCount = 0 - val apiError get() = apiErrorCount > 0 - } + val apiError get() = apiErrorCount > 0 @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt index 2586f2257b4b..95ec0684fde9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt @@ -23,7 +23,7 @@ import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ExcavatorProfitTracker { +object ExcavatorProfitTracker { private val config get() = SkyHanniMod.feature.mining.fossilExcavator.profitTracker diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt index 18418f959b8f..3c7da639b190 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GlacitePowderFeatures { +object GlacitePowderFeatures { private val config get() = SkyHanniMod.feature.mining.fossilExcavator private val patternGroup = RepoPattern.group("inventory.item.overlay") diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ProfitPerExcavation.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ProfitPerExcavation.kt index 74fb3be55baa..97cf829d0e42 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ProfitPerExcavation.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ProfitPerExcavation.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ProfitPerExcavation { +object ProfitPerExcavation { private val config get() = SkyHanniMod.feature.mining.fossilExcavator @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/CorpseAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/CorpseAPI.kt index db16e4d58214..4ab47eed90b3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/CorpseAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/CorpseAPI.kt @@ -10,7 +10,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class CorpseAPI { +object CorpseAPI { private val patternGroup = RepoPattern.group("mining.mineshaft") private val chatPatternGroup = patternGroup.group("chat") diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/MineshaftCorpseProfitPer.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/MineshaftCorpseProfitPer.kt index d8dbe9e28fa4..5cb332c7c2a8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/MineshaftCorpseProfitPer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/MineshaftCorpseProfitPer.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class MineshaftCorpseProfitPer { +object MineshaftCorpseProfitPer { private val config get() = SkyHanniMod.feature.mining.mineshaft @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/InfernoMinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/InfernoMinionFeatures.kt index e8b317803a8f..ac9dbef12174 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/InfernoMinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/InfernoMinionFeatures.kt @@ -15,7 +15,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class InfernoMinionFeatures { +object InfernoMinionFeatures { private val config get() = SkyHanniMod.feature.misc.minions private val infernoMinionTitlePattern by RepoPattern.pattern( "minion.infernominiontitle", diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt index b1b222986ba8..8c67a295ff88 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.mc.McPlayer import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class MinionCollectLogic { +object MinionCollectLogic { private var oldMap = mapOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index e1ed243ddccf..742f2191e174 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -60,7 +60,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class MinionFeatures { +object MinionFeatures { private val config get() = SkyHanniMod.feature.misc.minions private var lastClickedEntity: LorenzVec? = null @@ -89,6 +89,11 @@ class MinionFeatures { "^§aCollect All$" ) + var lastMinion: LorenzVec? = null + private var lastStorage: LorenzVec? = null + var minionInventoryOpen = false + var minionStorageInventoryOpen = false + @SubscribeEvent fun onPlayerInteract(event: PlayerInteractEvent) { if (!isEnabled()) return @@ -212,7 +217,7 @@ class MinionFeatures { val size = removedEntities.size if (size == 0) return - Companion.minions = minions.editCopy { + this.minions = minions.editCopy { for (removedEntity in removedEntities) { remove(removedEntity) } @@ -395,25 +400,17 @@ class MinionFeatures { } } - companion object { - - var lastMinion: LorenzVec? = null - var lastStorage: LorenzVec? = null - var minionInventoryOpen = false - var minionStorageInventoryOpen = false - - private var minions: Map? - get() { - return ProfileStorageData.profileSpecific?.minions - } - set(value) { - ProfileStorageData.profileSpecific?.minions = value - } - - fun clearMinionData() { - minions = mutableMapOf() - ChatUtils.chat("Manually reset all private island minion location data!") + private var minions: Map? + get() { + return ProfileStorageData.profileSpecific?.minions } + set(value) { + ProfileStorageData.profileSpecific?.minions = value + } + + fun clearMinionData() { + minions = mutableMapOf() + ChatUtils.chat("Manually reset all private island minion location data!") } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt index 99d39781759e..0b3cdf5437b6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt @@ -26,7 +26,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.EnumMap -class MinionXp { +object MinionXp { private val config get() = SkyHanniMod.feature.misc.minions diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BetterSignEditing.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BetterSignEditing.kt index d71b428dbdc6..2d7f2fb09785 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/BetterSignEditing.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BetterSignEditing.kt @@ -12,7 +12,7 @@ import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiScreen import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class BetterSignEditing { +object BetterSignEditing { private var pasteLastClicked = false private var copyLastClicked = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BetterWikiFromMenus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BetterWikiFromMenus.kt index 22834c7b229c..544a6814d0c6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/BetterWikiFromMenus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BetterWikiFromMenus.kt @@ -10,7 +10,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class BetterWikiFromMenus { +object BetterWikiFromMenus { private val config get() = SkyHanniMod.feature.misc.commands.betterWiki diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt index d4ed4f815baf..07cbdd994b76 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class BrewingStandOverlay { +object BrewingStandOverlay { @SubscribeEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt index 7e72a7cf06ba..31cfec4d9562 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt @@ -8,7 +8,7 @@ import net.minecraft.client.gui.GuiIngameMenu import net.minecraftforge.client.event.GuiScreenEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ButtonOnPause { +object ButtonOnPause { private val config get() = SkyHanniMod.feature.gui private val buttonId = System.nanoTime().toInt() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt index c701469246fc..d63a43943d75 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt @@ -15,7 +15,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class CurrentPetDisplay { +object CurrentPetDisplay { private val config get() = SkyHanniMod.feature.misc.pets diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt index 56bba94cb2f0..b550e1b48f9a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class CustomTextBox { +object CustomTextBox { private val config get() = SkyHanniMod.feature.gui.customTextBox private var display = listOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ExpOrbsOnGroundHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ExpOrbsOnGroundHider.kt index 5d1b34564596..c8a6e4f37630 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ExpOrbsOnGroundHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ExpOrbsOnGroundHider.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.entity.item.EntityXPOrb import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ExpOrbsOnGroundHider { +object ExpOrbsOnGroundHider { @SubscribeEvent fun onCheckRender(event: CheckRenderEntityEvent<*>) { @@ -17,4 +17,4 @@ class ExpOrbsOnGroundHider { event.isCanceled = true } } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt index 0f94d7132735..f0deee140701 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt @@ -9,7 +9,7 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.hours -class FixNEUHeavyPearls { +object FixNEUHeavyPearls { private val config get() = SkyHanniMod.feature.misc diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt index cd842f6bba9b..82fce8db4a44 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HideArmor.kt @@ -16,7 +16,7 @@ import net.minecraft.item.ItemStack import net.minecraft.potion.Potion import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class HideArmor { +object HideArmor { private val config get() = SkyHanniMod.feature.misc.hideArmor2 private var armor = mapOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HideFarEntities.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HideFarEntities.kt index 7cdd95bcfe6b..1e2de2e93a04 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/HideFarEntities.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HideFarEntities.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.mc.McWorld import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class HideFarEntities { +object HideFarEntities { private val config get() = SkyHanniMod.feature.misc.hideFarEntities private var ignored = emptySet() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt index bbb5eaaf6584..c1f7d84c3fca 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.utils.datetime.TimeUtils.formatted import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class InGameDateDisplay { +object InGameDateDisplay { private val config get() = SkyHanniMod.feature.gui.inGameDate diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/JerryIslandTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/JerryIslandTimer.kt index 11620aca8ecf..573f239b72a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/JerryIslandTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/JerryIslandTimer.kt @@ -17,7 +17,7 @@ import java.text.SimpleDateFormat import kotlin.time.Duration.Companion.days import kotlin.time.Duration.Companion.seconds -class JerryIslandTimer { +object JerryIslandTimer { private val config get() = SkyHanniMod.feature.gui private val winterConfig get() = SkyHanniMod.feature.event.winter diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt index f0cf942648d1..4f32d4cfae61 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class JoinCrystalHollows { +object JoinCrystalHollows { private var lastWrongPassTime = 0L diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt index fb0eb95db639..b31e4593b17c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt @@ -12,12 +12,12 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class LesserOrbHider { +object LesserOrbHider { private val config get() = SkyHanniMod.feature.misc private val hiddenEntities = CollectionUtils.weakReferenceList() - private val lesserTexture = + private const val LESSER_ORB_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjgzMjM2NjM5NjA3MDM2YzFiYTM5MWMyYjQ2YTljN2IwZWZkNzYwYzhiZmEyOTk2YTYwNTU1ODJiNGRhNSJ9fX0=" @SubscribeEvent @@ -25,7 +25,7 @@ class LesserOrbHider { val entity = event.entity val itemStack = event.newItemStack ?: return - if (entity is EntityArmorStand && event.isHand && itemStack.getSkullTexture() == lesserTexture) { + if (entity is EntityArmorStand && event.isHand && itemStack.getSkullTexture() == LESSER_ORB_TEXTURE) { hiddenEntities.add(entity) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt index aad4e0706879..960decbfef3c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt @@ -17,81 +17,78 @@ import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class MarkedPlayerManager { - companion object { +object MarkedPlayerManager { - val config get() = SkyHanniMod.feature.gui.markedPlayers + private val config get() = SkyHanniMod.feature.gui.markedPlayers - val playerNamesToMark = mutableListOf() - private val markedPlayers = mutableMapOf() + private val playerNamesToMark = mutableListOf() + private val markedPlayers = mutableMapOf() - fun command(args: Array) { - if (args.size != 1) { - ChatUtils.userError("Usage: /shmarkplayer ") - return - } - - val displayName = args[0] - val name = displayName.lowercase() + fun command(args: Array) { + if (args.size != 1) { + ChatUtils.userError("Usage: /shmarkplayer ") + return + } + val displayName = args[0] + val name = displayName.lowercase() - if (name == McPlayer.name.lowercase()) { - ChatUtils.userError("You can't add or remove yourself this way! Go to the settings and toggle 'Mark your own name'.") - return - } + if (name == McPlayer.name.lowercase()) { + ChatUtils.userError("You can't add or remove yourself this way! Go to the settings and toggle 'Mark your own name'.") + return + } - if (name !in playerNamesToMark) { - playerNamesToMark.add(name) - findPlayers() - ChatUtils.chat("§aMarked §eplayer §b$displayName§e!") - } else { - playerNamesToMark.remove(name) - markedPlayers[name]?.let { RenderLivingEntityHelper.removeCustomRender(it) } - markedPlayers.remove(name) - ChatUtils.chat("§cUnmarked §eplayer §b$displayName§e!") - } + if (name !in playerNamesToMark) { + playerNamesToMark.add(name) + findPlayers() + ChatUtils.chat("§aMarked §eplayer §b$displayName§e!") + } else { + playerNamesToMark.remove(name) + markedPlayers[name]?.let { RenderLivingEntityHelper.removeCustomRender(it) } + markedPlayers.remove(name) + ChatUtils.chat("§cUnmarked §eplayer §b$displayName§e!") } + } - private fun findPlayers() { - for (entity in McWorld.getEntitiesOf()) { - if (entity in markedPlayers.values) continue + private fun findPlayers() { + for (entity in McWorld.getEntitiesOf()) { + if (entity in markedPlayers.values) continue - val name = entity.name.lowercase() - if (name in playerNamesToMark) { - markedPlayers[name] = entity - entity.setColor() - } + val name = entity.name.lowercase() + if (name in playerNamesToMark) { + markedPlayers[name] = entity + entity.setColor() } } + } - private fun refreshColours() = - markedPlayers.forEach { - it.value.setColor() - } - - private fun EntityOtherPlayerMP.setColor() { - RenderLivingEntityHelper.setEntityColorWithNoHurtTime( - this, - config.entityColor.get().toColor().withAlpha(127), - ::isEnabled - ) + private fun refreshColours() = + markedPlayers.forEach { + it.value.setColor() } - fun isMarkedPlayer(player: String): Boolean = player.lowercase() in playerNamesToMark + private fun EntityOtherPlayerMP.setColor() { + RenderLivingEntityHelper.setEntityColorWithNoHurtTime( + this, + config.entityColor.get().toColor().withAlpha(127), + ::isEnabled + ) + } + + fun isMarkedPlayer(player: String): Boolean = player.lowercase() in playerNamesToMark - private fun isEnabled() = (LorenzUtils.inSkyBlock || OutsideSbFeature.MARKED_PLAYERS.isSelected()) - && config.highlightInWorld + private fun isEnabled() = (LorenzUtils.inSkyBlock || OutsideSbFeature.MARKED_PLAYERS.isSelected()) + && config.highlightInWorld - fun replaceInChat(string: String): String { - if (!config.highlightInChat) return string + fun replaceInChat(string: String): String { + if (!config.highlightInChat) return string - val color = config.chatColor.getChatColor() - var text = string - for (markedPlayer in playerNamesToMark) { - text = text.replace(markedPlayer, "$color$markedPlayer§r") - } - return text + val color = config.chatColor.getChatColor() + var text = string + for (markedPlayer in playerNamesToMark) { + text = text.replace(markedPlayer, "$color$markedPlayer§r") } + return text } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt index f0e9fe9e29c7..96d7bfdcaef0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt @@ -12,7 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent /** * I need these features in my dev env */ -class MiscFeatures { +object MiscFeatures { @SubscribeEvent fun onEnderTeleport(event: EnderTeleportEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt index 00333215eed9..83283e28960a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt @@ -14,24 +14,21 @@ import net.minecraft.init.Blocks import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer -class MovementSpeedDisplay { +object MovementSpeedDisplay { private val config get() = SkyHanniMod.feature.misc private var display = "" private val soulsandSpeeds = mutableListOf() - companion object { - /** - * This speed value represents the movement speed in blocks per second. - * This has nothing to do with the speed stat. - */ - var speed = 0.0 - var usingSoulsandSpeed = false - } + /** + * This speed value represents the movement speed in blocks per second. + * This has nothing to do with the speed stat. + */ + var speed = 0.0 + var usingSoulsandSpeed = false init { - // TODO use LorenzTickEvent fixedRateTimer(name = "skyhanni-movement-speed-display", period = 250, initialDelay = 1_000) { checkSpeed() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index a045222a7a6d..3b4ce67aed58 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -32,7 +32,7 @@ import kotlin.time.Duration.Companion.hours import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds -class NonGodPotEffectDisplay { +object NonGodPotEffectDisplay { private val config get() = SkyHanniMod.feature.misc.potionEffect private var checkFooter = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt index a9b696e795c3..08112b408665 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt @@ -9,7 +9,7 @@ import net.minecraft.entity.projectile.EntitySmallFireball import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ParticleHider { +object ParticleHider { private fun inM7Boss() = DungeonAPI.inDungeon() && DungeonAPI.dungeonFloor == "M7" && DungeonAPI.inBossRoom diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt index 8724cd7ab80b..673391de04e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt @@ -11,7 +11,7 @@ import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.entity.Entity import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class PartyMemberOutlines { +object PartyMemberOutlines { private val config get() = SkyHanniMod.feature.misc.highlightPartyMembers diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt index 7f0a45ac9e54..39b8df644c51 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt @@ -20,7 +20,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class PatcherSendCoordinates { +object PatcherSendCoordinates { private val config get() = SkyHanniMod.feature.misc.patcherCoordsWaypoint private val patcherBeacon = mutableListOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt index 886827e23a1a..1f73c573dfff 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt @@ -10,7 +10,7 @@ import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetCandyUsed import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetLevel import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class PetCandyUsedDisplay { +object PetCandyUsedDisplay { private val config get() = SkyHanniMod.feature.misc.petCandy diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt index c41e5a3ed597..ecf8db84d69a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt @@ -19,7 +19,7 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class PetExpTooltip { +object PetExpTooltip { private val config get() = SkyHanniMod.feature.misc.pets.petExperienceToolTip private val level100Common = 5_624_785 diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt index 2f692708342a..395c5ee64ff7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetItem import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class PetItemDisplay { +object PetItemDisplay { private val config get() = SkyHanniMod.feature.misc.pets diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt index f60eb930ee27..66927c40d2f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt @@ -10,10 +10,10 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawSlotText import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAppliedPocketSackInASack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class PocketSackInASackDisplay { +object PocketSackInASackDisplay { private val config get() = SkyHanniMod.feature.inventory.pocketSackInASack - private val maxedStitched = 3 + private const val MAX_STITCHES = 3 @SubscribeEvent fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) { @@ -41,8 +41,8 @@ class PocketSackInASackDisplay { var next = false for (line in iterator) { if (line.contains("7This sack is")) { - val color = if (applied == maxedStitched) "§a" else "§b" - iterator.set("§7This sack is stitched $color$applied§7/$color$maxedStitched") + val color = if (applied == MAX_STITCHES) "§a" else "§b" + iterator.set("§7This sack is stitched $color$applied§7/$color$MAX_STITCHES") next = true continue } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PrivateIslandNoPickaxeAbility.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PrivateIslandNoPickaxeAbility.kt index 65559d8a6726..9ad07ed8e86f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PrivateIslandNoPickaxeAbility.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PrivateIslandNoPickaxeAbility.kt @@ -9,9 +9,9 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class PrivateIslandNoPickaxeAbility { +object PrivateIslandNoPickaxeAbility { - val config get() = SkyHanniMod.feature.mining + private val config get() = SkyHanniMod.feature.mining @SubscribeEvent fun onClick(event: WorldClickEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ReplaceRomanNumerals.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ReplaceRomanNumerals.kt index 3a93588b6547..e90e09dcef2d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ReplaceRomanNumerals.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ReplaceRomanNumerals.kt @@ -10,14 +10,12 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.StringUtils.applyIfPossible import at.hannibal2.skyhanni.utils.StringUtils.isRoman import at.hannibal2.skyhanni.utils.StringUtils.removeColor -import net.minecraft.event.ClickEvent import net.minecraft.event.HoverEvent import net.minecraft.util.ChatComponentText -import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ReplaceRomanNumerals { +object ReplaceRomanNumerals { // Using toRegex here since toPattern doesn't seem to provide the necessary functionality private val splitRegex = "((§\\w)|(\\s+)|(\\W))+|(\\w*)".toRegex() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt index 8bba37ed2371..2f7464606ddd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt @@ -10,7 +10,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.anyMatches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class RestorePieceOfWizardPortalLore { +object RestorePieceOfWizardPortalLore { private val config get() = SkyHanniMod.feature.misc diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt index a27735b7d6e4..6487841c0860 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt @@ -14,7 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds -class SkyBlockKickDuration { +object SkyBlockKickDuration { private val config get() = SkyHanniMod.feature.misc.kickDuration diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/SuperpairsClicksAlert.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/SuperpairsClicksAlert.kt index 4c2d419437e8..8936888abd1f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/SuperpairsClicksAlert.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/SuperpairsClicksAlert.kt @@ -10,7 +10,7 @@ import at.hannibal2.skyhanni.utils.mc.McSound import at.hannibal2.skyhanni.utils.mc.McSound.play import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SuperpairsClicksAlert { +object SuperpairsClicksAlert { private val config get() = SkyHanniMod.feature.misc diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TabWidgetSettings.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TabWidgetSettings.kt index c3bc3a38e02d..8766cc80514e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TabWidgetSettings.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TabWidgetSettings.kt @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class TabWidgetSettings { +object TabWidgetSettings { private val patternGroup = RepoPattern.group("tab.widget.setting") private val mainPageSettingPattern by patternGroup.pattern( "gui", diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt index 1b99d44d3cba..b91849fb20e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt @@ -12,15 +12,12 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer -class TpsCounter { +object TpsCounter { private val config get() = SkyHanniMod.feature.gui - companion object { - - private const val MIN_DATA_AMOUNT = 5 - private const val WAIT_AFTER_WORLD_SWITCH = 6 - } + private const val MIN_DATA_AMOUNT = 5 + private const val WAIT_AFTER_WORLD_SWITCH = 6 private var packetsFromLastSecond = 0 private var tpsList = mutableListOf() @@ -30,7 +27,6 @@ class TpsCounter { private var display = "" init { - // TODO use SecondPassedEvent + passedSince fixedRateTimer(name = "skyhanni-tps-counter-seconds", period = 1000L) { if (!isEnabled()) return@fixedRateTimer if (packetsFromLastSecond == 0) return@fixedRateTimer diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt index a8f323256893..14ac05447d5a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt @@ -32,6 +32,7 @@ object AdvancedPlayerList { val tabPlayerData = mutableMapOf() private val config get() = SkyHanniMod.feature.gui.compactTabList.advancedPlayerList + private val markedPlayerConfig get() = SkyHanniMod.feature.gui.markedPlayers private val levelPattern by RepoPattern.pattern( "misc.compacttablist.advanced.level", @@ -249,7 +250,7 @@ object AdvancedPlayerList { enum class SocialIcon(val icon: () -> String, val score: Int) { ME("", 10), - MARKED({ "${MarkedPlayerManager.config.chatColor.getChatColor()}§lMARKED" }, 8), + MARKED({ "${markedPlayerConfig.chatColor.getChatColor()}§lMARKED" }, 8), PARTY("§9§lP", 5), FRIEND("§d§lF", 4), GUILD("§2§lG", 3), diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt index 2b770367512d..8929b19b5b58 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class EstimatedWardrobePrice { +object EstimatedWardrobePrice { private val config get() = SkyHanniMod.feature.inventory.estimatedItemValues var data = mutableMapOf>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/GlowingDroppedItems.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/GlowingDroppedItems.kt index b2b97c38195f..75ac5fc9fb71 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/GlowingDroppedItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/GlowingDroppedItems.kt @@ -15,7 +15,7 @@ import net.minecraft.entity.item.EntityItem import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class GlowingDroppedItems { +object GlowingDroppedItems { private val config get() = SkyHanniMod.feature.misc.glowingDroppedItems diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt index f540164d2bdd..f7ead034faf9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt @@ -18,7 +18,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class LimboPlaytime { +object LimboPlaytime { private lateinit var modifiedList: MutableList private var setMinutes = false private val patternGroup = RepoPattern.group("misc.limbo.tooltip") @@ -36,7 +36,7 @@ class LimboPlaytime { private val storage get() = ProfileStorageData.playerSpecific?.limbo - private val itemName = "§aLimbo" + private const val LIMBO_ITEM_NAME = "§aLimbo" private lateinit var limboItem: ItemStack private var lastCreateCooldown = SimpleTimeMark.farPast() @@ -52,7 +52,7 @@ class LimboPlaytime { lastCreateCooldown = SimpleTimeMark.now() limboItem = Utils.createItemStack( SkyhanniItems.ENDER_PEARL().getItemStack().item, - itemName, + LIMBO_ITEM_NAME, *createItemLore() ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt index 4576ebe43af2..1eec16bdbdfe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt @@ -11,7 +11,7 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class TeleportPadCompactName { +object TeleportPadCompactName { private val patternGroup = RepoPattern.group("misc.teleportpad") private val namePattern by patternGroup.pattern( "name", diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt index 42450f72c4b9..41c5d92e669d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt @@ -10,7 +10,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class TeleportPadInventoryNumber { +object TeleportPadInventoryNumber { private val numbers: Map by lazy { val baseNumber = mapOf( diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/MatriarchHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/MatriarchHelper.kt index a9c0b0bf3f78..dad60946caca 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/MatriarchHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/MatriarchHelper.kt @@ -16,7 +16,7 @@ import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.TreeSet -class MatriarchHelper { +object MatriarchHelper { private val config get() = SkyHanniMod.feature.crimsonIsle.matriarchHelper diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt index 53ae592b81f7..1db26f082d69 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt @@ -15,7 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes // https://wiki.hypixel.net/Pablo -class PabloHelper { +object PabloHelper { private val config get() = SkyHanniMod.feature.crimsonIsle diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt index 7442ead7ee0a..c886d67ac0ee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt @@ -21,12 +21,12 @@ import net.minecraft.util.BlockPos import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color -class SulphurSkitterBox { +object SulphurSkitterBox { private val config get() = SkyHanniMod.feature.fishing.trophyFishing.sulphurSkitterBox private var spongeBlocks = listOf() private var closestBlock: BlockPos? = null - private val radius = 8 + private const val RADIUS = 8 @SubscribeEvent fun onTick(event: LorenzTickEvent) { @@ -43,8 +43,8 @@ class SulphurSkitterBox { val loc = it.toLorenzVec() loc.getBlockAt() == Blocks.sponge && loc.distanceToPlayer() <= 15 }.filter { - val pos1 = it.add(-radius, -radius, -radius) - val pos2 = it.add(radius, radius, radius) + val pos1 = it.add(-RADIUS, -RADIUS, -RADIUS) + val pos2 = it.add(RADIUS, RADIUS, RADIUS) BlockPos.getAllInBox(pos1, pos2).any { pos -> pos.toLorenzVec().getBlockAt() in FishingAPI.lavaBlocks } @@ -63,8 +63,8 @@ class SulphurSkitterBox { closestBlock?.let { val vec = it.toLorenzVec() if (vec.distanceToPlayer() >= 50) return - val pos1 = vec.add(-radius, -radius, -radius) - val pos2 = vec.add(radius, radius, radius) + val pos1 = vec.add(-RADIUS, -RADIUS, -RADIUS) + val pos2 = vec.add(RADIUS, RADIUS, RADIUS) val axis = BoundingBox(pos1, pos2).expandToEdge() drawBox(axis, event.partialTicks) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt index 120f8b914276..3fda7030c37a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class VolcanoExplosivityDisplay { +object VolcanoExplosivityDisplay { private val config get() = SkyHanniMod.feature.crimsonIsle private val patternGroup = RepoPattern.group("crimson.volcano") diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt index 01f97af9f34b..bcf636902e7f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt @@ -21,7 +21,7 @@ import net.minecraft.entity.monster.EntityBlaze import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class AshfangBlazes { +object AshfangBlazes { private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt index 24716dcfb2b1..8d3bda4d2574 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt @@ -17,11 +17,11 @@ import at.hannibal2.skyhanni.utils.mc.McWorld import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class AshfangBlazingSouls { +object AshfangBlazingSouls { private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang.blazingSouls - private val texture = + private const val SOUL_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODI4N2IzOTdkYWY5NTE2YTBiZDc2ZjVmMWI3YmY5Nzk1MTVkZjNkNWQ4MzNlMDYzNWZhNjhiMzdlZTA4MjIxMiJ9fX0=" private val souls = mutableListOf() @@ -30,7 +30,7 @@ class AshfangBlazingSouls { if (!isEnabled()) return McWorld.getEntitiesOf() - .filter { it !in souls && it.hasSkullTexture(texture) } + .filter { it !in souls && it.hasSkullTexture(SOUL_TEXTURE) } .forEach { souls.add(it) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt index 5d9987a450e8..be7a98a675ca 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt @@ -17,11 +17,11 @@ import at.hannibal2.skyhanni.utils.mc.McWorld import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class AshfangGravityOrbs { +object AshfangGravityOrbs { private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang.gravityOrbs - private val texture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV" + + private const val ORB_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV" + "0L3RleHR1cmUvMWE2OWNjZjdhZDkwNGM5YTg1MmVhMmZmM2Y1YjRlMjNhZGViZjcyZWQxMmQ1ZjI0Yjc4Y2UyZDQ0YjRhMiJ9fX0=" private val orbs = mutableListOf() @@ -30,7 +30,7 @@ class AshfangGravityOrbs { if (!isEnabled()) return McWorld.getEntitiesOf() - .filter { it !in orbs && it.hasSkullTexture(texture) } + .filter { it !in orbs && it.hasSkullTexture(ORB_TEXTURE) } .forEach { orbs.add(it) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt index 6d318beab87c..a46c8abffe16 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt @@ -9,7 +9,7 @@ import net.minecraft.entity.EntityLivingBase import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class AshfangHideDamageIndicator { +object AshfangHideDamageIndicator { @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderLiving(event: SkyHanniRenderEntityEvent.Specials.Pre) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt index 6422dd40b6a0..27dd1e9935b8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt @@ -12,7 +12,7 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class AshfangHideParticles { +object AshfangHideParticles { private var nearAshfang = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt index 046efeb9b733..d0b682c40513 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt @@ -16,7 +16,7 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class AshfangNextResetCooldown { +object AshfangNextResetCooldown { private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang private var spawnTime = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt index 10942ed4dcc8..bd2bae6a8031 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt @@ -13,7 +13,7 @@ import net.minecraftforge.event.entity.living.LivingDeathEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color -class BlobbercystsHighlight { +object BlobbercystsHighlight { private val config get() = SkyHanniMod.feature.rift.area.colosseum private val entityList = mutableListOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt index 765066ab20c2..5d9b0c04eba4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.mc.McPlayer import at.hannibal2.skyhanni.utils.mc.McWorld.getBlockStateAt import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class RiftAgaricusCap { +object RiftAgaricusCap { private val config get() = RiftAPI.config.area.dreadfarm private var startTime = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt index 7888d15b6034..77c19a189029 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt @@ -24,7 +24,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color import kotlin.time.Duration.Companion.milliseconds -class RiftWiltedBerberisHelper { +object RiftWiltedBerberisHelper { private val config get() = RiftAPI.config.area.dreadfarm.wiltedBerberis private var isOnFarmland = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt index 34aabc4c72a9..95bb3969c3f4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt @@ -21,7 +21,7 @@ import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class LivingCaveDefenseBlocks { +object LivingCaveDefenseBlocks { private val config get() = RiftAPI.config.area.livingCave.defenseBlockConfig private var movingBlocks = mapOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt index 2ac0aee42bb9..771c78e53345 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzVec import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class LivingCaveLivingMetalHelper { +object LivingCaveLivingMetalHelper { private val config get() = RiftAPI.config.area.livingCave.livingCaveLivingMetalConfig private var lastClicked: LorenzVec? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt index cf616f227df8..636041857959 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.utils.mc.McPlayer import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class LivingMetalSuitProgress { +object LivingMetalSuitProgress { private val config get() = RiftAPI.config.area.livingCave.livingMetalSuitProgress private var display = emptyList>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt index f15badfe63a0..c914116d0e3b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.ParkourHelper import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class RiftLavaMazeParkour { +object RiftLavaMazeParkour { private val config get() = RiftAPI.config.area.mirrorverse.lavaMazeConfig private var parkourHelper: ParkourHelper? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt index 2c60dbce7ef2..977809c69596 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.ParkourHelper import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class RiftUpsideDownParkour { +object RiftUpsideDownParkour { private val config get() = RiftAPI.config.area.mirrorverse.upsideDownParkour private var parkourHelper: ParkourHelper? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt index 104fd6238d7c..37ab42e92af8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.math.BoundingBox import at.hannibal2.skyhanni.utils.mc.McPlayer import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class TubulatorParkour { +object TubulatorParkour { private val config get() = RiftAPI.config.area.mirrorverse.tubulatorConfig private var parkourHelper: ParkourHelper? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt index ef7b4667a078..692459bff1d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt @@ -20,15 +20,15 @@ import net.minecraft.entity.monster.EntitySilverfish import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes -class VerminHighlighter { +object VerminHighlighter { private val config get() = RiftAPI.config.area.westVillage.verminHighlight private val checkedEntites = TimeLimitedSet(1.minutes) // TODO repo - private val fly = + private const val FLY_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTMwYWMxZjljNjQ5Yzk5Y2Q2MGU0YmZhNTMzNmNjMTg1MGYyNzNlYWI5ZjViMGI3OTQwZDRkNGQ3ZGM4MjVkYyJ9fX0=" - private val spider = + private const val SPIDER_TEXTURE = "ewogICJ0aW1lc3RhbXAiIDogMTY1MDU1NjEzMTkxNywKICAicHJvZmlsZUlkIiA6ICI0ODI5MmJkMjI1OTc0YzUwOTZiMTZhNjEyOGFmMzY3NSIsCiAgInByb2ZpbGVOYW1lIiA6ICJLVVJPVE9ZVEIyOCIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84ZmRmNjJkNGUwM2NhNTk0YzhjZDIxZGQxNzUzMjdmMWNmNzdjNGJjMDU3YTA5NTk2MDNkODNhNjhiYTI3MDA4IgogICAgfQogIH0KfQ==" @SubscribeEvent @@ -55,7 +55,7 @@ class VerminHighlighter { } private fun isVermin(entity: EntityLivingBase): Boolean = when (entity) { - is EntityArmorStand -> entity.hasSkullTexture(fly) || entity.hasSkullTexture(spider) + is EntityArmorStand -> entity.hasSkullTexture(FLY_TEXTURE) || entity.hasSkullTexture(SPIDER_TEXTURE) is EntitySilverfish -> entity.baseMaxHealth == 8 else -> false diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt index 0cdbadcedc72..4e6c44533afe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/kloon/KloonHacking.kt @@ -23,7 +23,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class KloonHacking { +object KloonHacking { private val config get() = RiftAPI.config.area.westVillage.hacking diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftLarva.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftLarva.kt index f7ffd8704964..e70772657b18 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftLarva.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftLarva.kt @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.utils.mc.McWorld import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class RiftLarva { +object RiftLarva { private val config get() = RiftAPI.config.area.wyldWoods.larvas private var hasHookInHand = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt index 1586a87ecf8d..5912f445ec94 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt @@ -13,11 +13,11 @@ import at.hannibal2.skyhanni.utils.mc.McWorld import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class RiftOdonata { +object RiftOdonata { private val config get() = RiftAPI.config.area.wyldWoods.odonata private var hasBottleInHand = false - private val odonataSkullTexture = + private const val ODONATA_SKULL_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWZkODA2ZGVmZGZkZjU5YjFmMjYwOWM4ZWUzNjQ2NjZkZTY2MTI3YTYyMzQxNWI1NDMwYzkzNThjNjAxZWY3YyJ9fX0=" private val emptyBottle by lazy { SkyhanniItems.EMPTY_ODONATA_BOTTLE() } @@ -36,7 +36,7 @@ class RiftOdonata { private fun findOdonatas() { for (stand in McWorld.getEntitiesOf()) { - if (stand.hasSkullTexture(odonataSkullTexture)) { + if (stand.hasSkullTexture(ODONATA_SKULL_TEXTURE)) { RenderLivingEntityHelper.setEntityColor( stand, config.highlightColor.toChromaColor().withAlpha(1) diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt index de011b343bd1..e0dd0216eace 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class HighlightRiftGuide { +object HighlightRiftGuide { private var inInventory = false private var highlightedItems = emptyList() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt index b908f49f852f..f08e93600e0e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt @@ -7,7 +7,7 @@ import at.hannibal2.skyhanni.utils.InventoryUtils import net.minecraft.entity.passive.EntityHorse import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class RiftHorsezookaHider { +object RiftHorsezookaHider { @SubscribeEvent fun onCheckRender(event: CheckRenderEntityEvent<*>) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt index 839986017cb9..5f69016a44c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt @@ -17,7 +17,7 @@ import kotlin.time.Duration import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds -class RiftTimer { +object RiftTimer { private val config get() = RiftAPI.config.timer diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt index 1555bc4a31e7..a8b3644a89ca 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt @@ -16,7 +16,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class RiftMotesOrb { +object RiftMotesOrb { private val config get() = RiftAPI.config.motesOrbs diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt index f5f0ac58a71f..42f41689a64e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt @@ -26,7 +26,7 @@ import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ShowMotesNpcSellPrice { +object ShowMotesNpcSellPrice { private val config get() = RiftAPI.config.motes diff --git a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillTooltip.kt index 3d8299b1b58e..98b6128e8d82 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillTooltip.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillTooltip.kt @@ -15,7 +15,7 @@ import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.StringUtils.isRoman import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SkillTooltip { +object SkillTooltip { private val overflowConfig get() = SkillProgress.config.overflowConfig private val customGoalConfig get() = SkillProgress.config.customGoalConfig diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt index eab95363b410..071433af5e69 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt @@ -10,7 +10,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern -class HideMobNames { +object HideMobNames { private val lastMobName = mutableMapOf() private val mobNamesHidden = mutableListOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt index 250573b3333c..670db5004bbb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class SlayerBossSpawnSoon { +object SlayerBossSpawnSoon { private val config get() = SkyHanniMod.feature.slayer.slayerBossWarning diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt index 30eaf81c5ab8..19c1cb89df46 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt @@ -17,7 +17,7 @@ import net.minecraft.init.Items import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class SlayerItemsOnGround { +object SlayerItemsOnGround { private val config get() = SkyHanniMod.feature.slayer.itemsOnGround diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt index 271c831f9fe8..fbad516cd204 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt @@ -24,7 +24,7 @@ import net.minecraft.entity.monster.EntityZombie import net.minecraft.entity.passive.EntityWolf import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SlayerMiniBossFeatures { +object SlayerMiniBossFeatures { private val config get() = SkyHanniMod.feature.slayer private var miniBosses = listOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt index 14db9a52dfe1..26a25b7a7146 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt @@ -18,7 +18,7 @@ import net.minecraft.entity.EntityLivingBase import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class SlayerQuestWarning { +object SlayerQuestWarning { private val config get() = SkyHanniMod.feature.slayer diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt index 43bd248319c7..9f70cfa5f8b3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt @@ -34,7 +34,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.math.ceil import kotlin.time.Duration.Companion.seconds -class SlayerRngMeterDisplay { +object SlayerRngMeterDisplay { private val config get() = SkyHanniMod.feature.slayer.rngMeterDisplay diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt index 7c9cd639cc99..e7d083a1b154 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt @@ -10,7 +10,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.entity.projectile.EntityFireball import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class BlazeSlayerClearView { +object BlazeSlayerClearView { private var nearBlaze = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt index 63f78431dd54..296d9db159dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt @@ -26,7 +26,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds -class BlazeSlayerDaggerHelper { +object BlazeSlayerDaggerHelper { private val config get() = SkyHanniMod.feature.slayer.blazes.hellion diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt index d7f5bb4eba32..e2906b3af6bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.mc.McSound import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class BlazeSlayerFirePitsWarning { +object BlazeSlayerFirePitsWarning { private val config get() = SkyHanniMod.feature.slayer.blazes diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/FirePillarDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/FirePillarDisplay.kt index 7cacd43bc8f5..1beb3e89e08f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/FirePillarDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/FirePillarDisplay.kt @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class FirePillarDisplay { +object FirePillarDisplay { private val config get() = SkyHanniMod.feature.slayer.blazes /** diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt index b95079d04ca1..5dcb03eebf47 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt @@ -37,7 +37,7 @@ import net.minecraft.init.Blocks import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds -class EndermanSlayerFeatures { +object EndermanSlayerFeatures { private val config get() = SkyHanniMod.feature.slayer.endermen private val beaconConfig get() = config.beacon @@ -46,7 +46,7 @@ class EndermanSlayerFeatures { private val nukekubiSkulls = mutableSetOf() private var sittingBeacon = mapOf() private val logger = LorenzLogger("slayer/enderman") - private val nukekubiSkulTexture = + private const val NUKEKUBI_SKULL_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0=" @SubscribeEvent @@ -78,7 +78,7 @@ class EndermanSlayerFeatures { } } - if (config.highlightNukekebi && entity.inventory.any { it?.getSkullTexture() == nukekubiSkulTexture } && entity !in nukekubiSkulls) { + if (config.highlightNukekebi && entity.inventory.any { it?.getSkullTexture() == NUKEKUBI_SKULL_TEXTURE } && entity !in nukekubiSkulls) { nukekubiSkulls.add(entity) RenderLivingEntityHelper.setEntityColor( entity, diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt index 20cb4936360a..0d884cb47a62 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt @@ -12,7 +12,7 @@ import net.minecraft.entity.monster.EntityEnderman import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class EndermanSlayerHideParticles { +object EndermanSlayerHideParticles { private var endermanLocations = listOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt b/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt index 92d604ce41b2..540a3c081b02 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt @@ -15,7 +15,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class HighlightPlaceableNpcs { +object HighlightPlaceableNpcs { private val config get() = SkyHanniMod.feature.misc.stranded diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt index ed64cff5da21..7251fccff6e6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt @@ -26,7 +26,7 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SummoningMobManager { +object SummoningMobManager { private val config get() = SkyHanniMod.feature.combat.summonings diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt index c709898bfc57..c1f4d2146c58 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt @@ -16,10 +16,10 @@ import net.minecraft.entity.EntityLiving import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SummoningSoulsName { +object SummoningSoulsName { // TODO repo - private val texture = + private const val TEXTURE = "ewogICJ0aW1lc3RhbXAiIDogMTYwMTQ3OTI2NjczMywKICAicHJvZmlsZUlkIiA6ICJmMzA1ZjA5NDI0NTg0ZjU" + "4YmEyYjY0ZjAyZDcyNDYyYyIsCiAgInByb2ZpbGVOYW1lIiA6ICJqcm9ja2EzMyIsCiAgInNpZ25hdH" + "VyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgI" + @@ -42,7 +42,7 @@ class SummoningSoulsName { for (entity in McWorld.getEntitiesOf()) { if (souls.contains(entity)) continue - if (entity.hasSkullTexture(texture)) { + if (entity.hasSkullTexture(TEXTURE)) { val soulLocation = entity.getLorenzVec() val map = mutableMapOf() diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt index eb7456b4c192..e1fc6357d690 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import net.minecraft.entity.EntityLivingBase import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class RenderLivingEntityHelper { +object RenderLivingEntityHelper { @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { @@ -15,61 +15,60 @@ class RenderLivingEntityHelper { entityNoHurTimeCondition.clear() } - companion object { + private val entityColorMap = mutableMapOf() + private val entityColorCondition = mutableMapOf Boolean>() - private val entityColorMap = mutableMapOf() - private val entityColorCondition = mutableMapOf Boolean>() + private val entityNoHurTimeCondition = mutableMapOf Boolean>() - private val entityNoHurTimeCondition = mutableMapOf Boolean>() - - fun removeEntityColor(entity: T) { - entityColorMap.remove(entity) - entityColorCondition.remove(entity) - } + fun removeEntityColor(entity: T) { + entityColorMap.remove(entity) + entityColorCondition.remove(entity) + } - fun setEntityColor(entity: T, color: Int, condition: () -> Boolean) { - entityColorMap[entity] = color - entityColorCondition[entity] = condition - } + fun setEntityColor(entity: T, color: Int, condition: () -> Boolean) { + entityColorMap[entity] = color + entityColorCondition[entity] = condition + } - fun setNoHurtTime(entity: T, condition: () -> Boolean) { - entityNoHurTimeCondition[entity] = condition - } + fun setNoHurtTime(entity: T, condition: () -> Boolean) { + entityNoHurTimeCondition[entity] = condition + } - fun setEntityColorWithNoHurtTime(entity: T, color: Int, condition: () -> Boolean) { - setEntityColor(entity, color, condition) - setNoHurtTime(entity, condition) - } + fun setEntityColorWithNoHurtTime(entity: T, color: Int, condition: () -> Boolean) { + setEntityColor(entity, color, condition) + setNoHurtTime(entity, condition) + } - fun removeNoHurtTime(entity: T) { - entityNoHurTimeCondition.remove(entity) - } + fun removeNoHurtTime(entity: T) { + entityNoHurTimeCondition.remove(entity) + } - fun removeCustomRender(entity: T) { - removeEntityColor(entity) - removeNoHurtTime(entity) - } + fun removeCustomRender(entity: T) { + removeEntityColor(entity) + removeNoHurtTime(entity) + } - fun internalSetColorMultiplier(entity: T): Int { - if (!SkyHanniDebugsAndTests.globalRender) return 0 - if (entityColorMap.containsKey(entity)) { - val condition = entityColorCondition[entity]!! - if (condition.invoke()) { - return entityColorMap[entity]!! - } + @JvmStatic + fun internalSetColorMultiplier(entity: T): Int { + if (!SkyHanniDebugsAndTests.globalRender) return 0 + if (entityColorMap.containsKey(entity)) { + val condition = entityColorCondition[entity]!! + if (condition.invoke()) { + return entityColorMap[entity]!! } - return 0 } + return 0 + } - fun internalChangeHurtTime(entity: T): Int { - if (!SkyHanniDebugsAndTests.globalRender) return entity.hurtTime - run { - val condition = entityNoHurTimeCondition[entity] ?: return@run - if (condition.invoke()) { - return 0 - } + @JvmStatic + fun internalChangeHurtTime(entity: T): Int { + if (!SkyHanniDebugsAndTests.globalRender) return entity.hurtTime + run { + val condition = entityNoHurTimeCondition[entity] ?: return@run + if (condition.invoke()) { + return 0 } - return entity.hurtTime } + return entity.hurtTime } } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java index f23b290f1d5f..5ef136e3f5c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java @@ -23,12 +23,12 @@ protected MixinRendererLivingEntity(RenderManager renderManager) { @Inject(method = "getColorMultiplier", at = @At("HEAD"), cancellable = true) private void setColorMultiplier(T entity, float lightBrightness, float partialTickTime, CallbackInfoReturnable cir) { - cir.setReturnValue(RenderLivingEntityHelper.Companion.internalSetColorMultiplier(entity)); + cir.setReturnValue(RenderLivingEntityHelper.internalSetColorMultiplier(entity)); } @Redirect(method = "setBrightness", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/EntityLivingBase;hurtTime:I", opcode = Opcodes.GETFIELD)) private int changeHurtTime(EntityLivingBase entity) { - return RenderLivingEntityHelper.Companion.internalChangeHurtTime(entity); + return RenderLivingEntityHelper.internalChangeHurtTime(entity); } @Inject(method = "renderLayers", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt b/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt index 89f8ba6bd2ab..d1aa514ef573 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt @@ -14,7 +14,7 @@ import net.minecraft.inventory.Slot import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class HighlightMissingRepoItems { +object HighlightMissingRepoItems { @SubscribeEvent(priority = EventPriority.LOWEST) fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt index 60a68e7f33c9..50ad32acf99d 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt @@ -16,7 +16,7 @@ import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds -class ParkourWaypointSaver { +object ParkourWaypointSaver { private val config get() = SkyHanniMod.feature.dev.waypoint private var timeLastSaved = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/test/ShowItemUuid.kt b/src/main/java/at/hannibal2/skyhanni/test/ShowItemUuid.kt index d0a66268622d..b7fb7a164561 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/ShowItemUuid.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/ShowItemUuid.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getItemUuid import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ShowItemUuid { +object ShowItemUuid { @SubscribeEvent fun onTooltip(event: LorenzToolTipEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 2c5e0ad8e4c5..5a53f8a17fae 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -15,7 +15,7 @@ import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorColorNames -import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.getBazaarData +import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.getBazaarData import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt b/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt index 9b11abd60f51..98b0dda35238 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class TestShowSlotNumber { +object TestShowSlotNumber { @SubscribeEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 1a6f8255fe17..186e36044062 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.data.jsonobjects.repo.MultiFilterJson import at.hannibal2.skyhanni.events.NeuProfileDataLoadedEvent import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent -import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.getBazaarData +import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.getBazaarData import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarDataHolder import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ItemBlink.checkBlinkItem diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index af20324ceec1..258c2246f55f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.data.GuiEditManager -import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsX -import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY -import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getDummySize +import at.hannibal2.skyhanni.data.GuiEditManager.getAbsX +import at.hannibal2.skyhanni.data.GuiEditManager.getAbsY +import at.hannibal2.skyhanni.data.GuiEditManager.getDummySize import at.hannibal2.skyhanni.data.model.Graph import at.hannibal2.skyhanni.data.model.toPositionsList import at.hannibal2.skyhanni.events.GuiContainerEvent @@ -451,6 +451,7 @@ object RenderUtils { GlStateManager.scale(effectiveScale, effectiveScale, 1F) val x = ((Utils.getMouseX() - getAbsX()) / effectiveScale).toInt() val y = ((Utils.getMouseY() - getAbsY()) / effectiveScale).toInt() + return x to y } @@ -498,7 +499,7 @@ object RenderUtils { transform() val minecraft = Minecraft.getMinecraft() val renderer = minecraft.renderManager.fontRenderer - val width = this.getDummySize().x / this.scale + val width = getDummySize().x / this.scale GlStateManager.translate(offsetX + 1.0, offsetY + 1.0, 0.0) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt index 2cb68e093200..2afb36e9b716 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt @@ -128,6 +128,7 @@ object RepoPatternManager { } } + // TODO fix this allowing single part keys val keyShape = Pattern.compile("^(?:[a-z0-9]+\\.)*[a-z0-9]+$") /** diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt index beceaf8f9f5f..2a3fd21d9983 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.config.features.misc.TrackerConfig.PriceFromEntry import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.TrackerManager -import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.getBazaarData +import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.getBazaarData import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList