From 4559e5ff05e19817a21ae49f1c0d8a97d273f6a1 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Sat, 10 Feb 2024 00:24:52 +0100 Subject: Splitting many utils functions from LorenzUtils up into other classes: ChatUtils, CollectionUtils, ConditionalUtils. And code cleanup #978 --- .../at/hannibal2/skyhanni/api/CollectionAPI.kt | 8 +- .../skyhanni/config/ConfigGuiForgeInterop.kt | 2 + .../hannibal2/skyhanni/config/ConfigGuiManager.kt | 1 - .../at/hannibal2/skyhanni/config/ConfigManager.kt | 1 + .../skyhanni/config/ConfigUpdaterMigrator.kt | 2 + .../at/hannibal2/skyhanni/config/SackData.java | 2 +- .../java/at/hannibal2/skyhanni/config/Storage.java | 16 +- .../hannibal2/skyhanni/config/commands/Commands.kt | 7 +- .../skyhanni/config/commands/SimpleCommand.kt | 3 + .../config/core/config/gui/GuiPositionEditor.kt | 1 + .../skyhanni/config/features/chat/ChatConfig.java | 3 +- .../crimsonisle/SulphurSkitterBoxConfig.java | 3 - .../garden/visitor/DropsStatisticsConfig.java | 13 +- .../skyhanni/config/features/misc/MiscConfig.java | 2 +- .../config/features/misc/pets/PetConfig.java | 1 + .../java/at/hannibal2/skyhanni/data/ChatManager.kt | 7 +- .../hannibal2/skyhanni/data/CropAccessoryData.kt | 3 +- .../hannibal2/skyhanni/data/EntityMovementData.kt | 1 + .../at/hannibal2/skyhanni/data/EventCounter.kt | 3 +- .../java/at/hannibal2/skyhanni/data/FriendAPI.kt | 1 + .../skyhanni/data/GardenCropMilestones.kt | 3 +- .../data/GardenCropMilestonesCommunityFix.kt | 14 +- .../hannibal2/skyhanni/data/GardenCropUpgrades.kt | 3 +- .../at/hannibal2/skyhanni/data/GuiEditManager.kt | 7 +- .../java/at/hannibal2/skyhanni/data/GuildAPI.kt | 1 + .../java/at/hannibal2/skyhanni/data/HypixelData.kt | 29 +- .../java/at/hannibal2/skyhanni/data/IslandType.kt | 3 +- .../skyhanni/data/ItemRenderBackground.kt | 3 +- .../at/hannibal2/skyhanni/data/LocationFixData.kt | 3 +- .../at/hannibal2/skyhanni/data/MayorElection.kt | 4 +- .../hannibal2/skyhanni/data/OtherInventoryData.kt | 3 +- .../at/hannibal2/skyhanni/data/OwnInventoryData.kt | 3 +- .../java/at/hannibal2/skyhanni/data/PartyAPI.kt | 10 +- .../hannibal2/skyhanni/data/ProfileStorageData.kt | 14 +- .../java/at/hannibal2/skyhanni/data/PurseAPI.kt | 1 + .../java/at/hannibal2/skyhanni/data/RenderData.kt | 8 +- .../java/at/hannibal2/skyhanni/data/SackAPI.kt | 8 +- .../at/hannibal2/skyhanni/data/ScoreboardData.kt | 3 +- .../at/hannibal2/skyhanni/data/SkillExperience.kt | 4 +- .../java/at/hannibal2/skyhanni/data/SlayerAPI.kt | 2 +- .../at/hannibal2/skyhanni/data/TitleManager.kt | 5 +- .../java/at/hannibal2/skyhanni/data/ToolTipData.kt | 1 + .../at/hannibal2/skyhanni/data/TrackerManager.kt | 4 +- .../data/jsonobjects/repo/ContributorListJson.java | 1 + .../skyhanni/data/jsonobjects/repo/GardenJson.java | 2 +- .../skyhanni/data/jsonobjects/repo/ItemsJson.java | 1 - .../skyhanni/data/model/ComposterUpgrade.kt | 1 + .../at/hannibal2/skyhanni/data/repo/RepoManager.kt | 28 +- .../at/hannibal2/skyhanni/data/repo/RepoUtils.kt | 8 +- .../hannibal2/skyhanni/events/BlockClickEvent.kt | 3 +- .../skyhanni/events/CheckRenderEntityEvent.kt | 4 +- .../at/hannibal2/skyhanni/events/CropClickEvent.kt | 4 +- .../skyhanni/events/EntityEquipmentChangeEvent.kt | 4 +- .../hannibal2/skyhanni/events/EntityMoveEvent.kt | 4 +- .../hannibal2/skyhanni/events/GuiContainerEvent.kt | 13 +- .../skyhanni/events/GuiRenderItemEvent.kt | 7 +- .../skyhanni/events/InventoryCloseEvent.kt | 1 + .../skyhanni/events/InventoryFullyOpenedEvent.kt | 1 + .../hannibal2/skyhanni/events/LorenzChatEvent.kt | 2 +- .../at/hannibal2/skyhanni/events/LorenzEvent.kt | 5 +- .../hannibal2/skyhanni/events/LorenzTickEvent.kt | 3 +- .../skyhanni/events/LorenzToolTipEvent.kt | 1 + .../at/hannibal2/skyhanni/events/PacketEvent.kt | 5 +- .../at/hannibal2/skyhanni/events/PlaySoundEvent.kt | 3 +- .../skyhanni/events/ReceiveParticleEvent.kt | 5 +- .../skyhanni/events/RenderEntityOutlineEvent.kt | 2 +- .../skyhanni/events/RenderItemTipEvent.kt | 3 +- .../skyhanni/events/RenderMobColoredEvent.kt | 4 +- .../skyhanni/events/ResetEntityHurtEvent.kt | 4 +- .../hannibal2/skyhanni/events/SackChangeEvent.kt | 2 +- .../skyhanni/events/SeaCreatureFishEvent.kt | 4 +- .../skyhanni/events/ServerBlockChangeEvent.kt | 4 +- .../skyhanni/features/bazaar/BazaarApi.kt | 2 + .../features/bazaar/BazaarBestSellMethod.kt | 1 + .../bazaar/BazaarCancelledBuyOrderClipboard.kt | 3 +- .../skyhanni/features/bazaar/BazaarDataHolder.kt | 7 +- .../features/bazaar/BazaarOpenPriceWebsite.kt | 1 + .../skyhanni/features/bazaar/BazaarOrderHelper.kt | 5 +- .../hannibal2/skyhanni/features/bingo/BingoAPI.kt | 1 + .../skyhanni/features/bingo/CompactBingoChat.kt | 6 +- .../skyhanni/features/bingo/FirstMinionTier.kt | 8 +- .../skyhanni/features/bingo/MinionCraftHelper.kt | 2 +- .../features/bingo/card/BingoCardDisplay.kt | 8 +- .../features/bingo/card/BingoCardReader.kt | 4 +- .../skyhanni/features/bingo/card/BingoCardTips.kt | 1 + .../features/bingo/card/goals/BingoGoal.kt | 1 + .../card/nextstephelper/BingoNextStepHelper.kt | 9 +- .../card/nextstephelper/steps/CollectionStep.kt | 1 + .../bingo/card/nextstephelper/steps/ItemsStep.kt | 1 + .../bingo/card/nextstephelper/steps/NextStep.kt | 2 +- .../card/nextstephelper/steps/SkillLevelStep.kt | 2 +- .../features/chat/ArachneChatMessageHider.kt | 1 + .../hannibal2/skyhanni/features/chat/ChatFilter.kt | 19 +- .../skyhanni/features/chat/ChatFilterGui.kt | 8 +- .../hannibal2/skyhanni/features/chat/ChatPeek.kt | 6 +- .../features/chat/CompactBestiaryChatMessage.kt | 6 +- .../features/chat/CompactSplashPotionMessage.kt | 6 +- .../skyhanni/features/chat/PlayerDeathMessages.kt | 3 +- .../skyhanni/features/chat/SkyblockXPInChat.kt | 4 +- .../hannibal2/skyhanni/features/chat/Translator.kt | 15 +- .../skyhanni/features/chat/WatchdogHider.kt | 1 + .../features/chat/playerchat/PlayerChatFilter.kt | 2 +- .../features/chat/playerchat/PlayerChatModifier.kt | 4 +- .../skyhanni/features/chroma/ChromaShader.kt | 1 + .../skyhanni/features/combat/BestiaryData.kt | 10 +- .../features/combat/damageindicator/BossType.kt | 19 +- .../combat/damageindicator/DamageCounter.kt | 3 +- .../damageindicator/DamageIndicatorManager.kt | 34 +- .../features/combat/damageindicator/EntityData.kt | 1 + .../features/combat/damageindicator/MobFinder.kt | 35 +- .../combat/endernodetracker/EnderNodeTracker.kt | 10 +- .../features/combat/ghostcounter/GhostCounter.kt | 13 +- .../features/combat/ghostcounter/GhostUtil.kt | 8 +- .../features/combat/mobs/AreaMiniBossFeatures.kt | 4 +- .../combat/mobs/AshfangMinisNametagHider.kt | 3 +- .../skyhanni/features/combat/mobs/MobHighlight.kt | 1 + .../skyhanni/features/combat/mobs/SpawnTimers.kt | 12 +- .../skyhanni/features/commands/PartyCommands.kt | 4 +- .../features/commands/SendCoordinatedCommand.kt | 5 +- .../features/commands/ViewRecipeCommand.kt | 3 +- .../skyhanni/features/commands/WarpIsCommand.kt | 2 +- .../skyhanni/features/commands/WikiManager.kt | 11 +- .../tabcomplete/GetFromSacksTabComplete.kt | 3 +- .../commands/tabcomplete/PlayerTabComplete.kt | 3 +- .../commands/tabcomplete/WarpTabComplete.kt | 3 +- .../skyhanni/features/cosmetics/ArrowTrail.kt | 2 +- .../features/cosmetics/CosmeticFollowingLine.kt | 7 +- .../skyhanni/features/dungeon/DungeonAPI.kt | 10 +- .../features/dungeon/DungeonBossMessages.kt | 2 +- .../skyhanni/features/dungeon/DungeonChatFilter.kt | 2 +- .../skyhanni/features/dungeon/DungeonCleanEnd.kt | 4 +- .../features/dungeon/DungeonDeathCounter.kt | 3 +- .../features/dungeon/DungeonFinderFeatures.kt | 2 +- .../features/dungeon/DungeonLividFinder.kt | 1 + .../features/dungeon/DungeonMilestonesDisplay.kt | 1 + .../features/dungeon/DungeonRankTabListColor.kt | 1 + .../features/dungeon/DungeonTeammateOutlines.kt | 2 +- .../skyhanni/features/dungeon/TerracottaPhase.kt | 1 + .../event/UniqueGiftingOpportunitiesFeatures.kt | 2 +- .../event/anniversary/Year300RaffleEvent.kt | 1 + .../skyhanni/features/event/diana/BurrowAPI.kt | 1 - .../features/event/diana/BurrowWarpHelper.kt | 11 +- .../features/event/diana/DianaProfitTracker.kt | 7 +- .../features/event/diana/GriffinBurrowHelper.kt | 17 +- .../event/diana/GriffinBurrowParticleFinder.kt | 2 +- .../features/event/diana/GriffinPetWarning.kt | 4 +- .../features/event/diana/HighlightInquisitors.kt | 1 + .../event/diana/InquisitorWaypointShare.kt | 20 +- .../event/diana/MythologicalCreatureTracker.kt | 15 +- .../features/event/diana/SoopyGuessBurrow.kt | 6 +- .../features/event/jerry/HighlightJerries.kt | 5 +- .../event/jerry/frozentreasure/FrozenTreasure.kt | 1 + .../jerry/frozentreasure/FrozenTreasureTracker.kt | 5 +- .../event/lobby/waypoints/EventWaypoint.kt | 2 +- .../lobby/waypoints/christmas/PresentWaypoints.kt | 6 +- .../lobby/waypoints/halloween/BasketEntrances.kt | 3 +- .../lobby/waypoints/halloween/BasketWaypoints.kt | 1 + .../skyhanni/features/event/spook/TheGreatSpook.kt | 4 +- .../skyhanni/features/event/winter/JyrreTimer.kt | 1 + .../features/event/winter/NewYearCakeReminder.kt | 4 +- .../features/fame/AccountUpgradeReminder.kt | 6 +- .../skyhanni/features/fame/CityProjectFeatures.kt | 9 +- .../skyhanni/features/fame/ReminderUtils.kt | 1 + .../skyhanni/features/fishing/ChumBucketHider.kt | 5 +- .../skyhanni/features/fishing/FishingAPI.kt | 2 +- .../features/fishing/FishingBaitWarnings.kt | 6 +- .../skyhanni/features/fishing/FishingDetection.kt | 1 + .../features/fishing/FishingHookDisplay.kt | 1 + .../skyhanni/features/fishing/FishingTimer.kt | 4 +- .../features/fishing/SeaCreatureFeatures.kt | 9 +- .../features/fishing/SeaCreatureManager.kt | 1 + .../fishing/SeaCreatureMessageShortener.kt | 1 + .../skyhanni/features/fishing/SharkFishCounter.kt | 4 +- .../features/fishing/ShowFishingItemName.kt | 2 +- .../fishing/tracker/FishingProfitTracker.kt | 7 +- .../features/fishing/tracker/SeaCreatureTracker.kt | 17 +- .../features/fishing/trophy/OdgerWaypoint.kt | 1 + .../features/fishing/trophy/TrophyFishFillet.kt | 1 + .../features/fishing/trophy/TrophyFishManager.kt | 4 +- .../features/fishing/trophy/TrophyFishMessages.kt | 22 +- .../features/fishing/trophy/TrophyRarity.kt | 3 +- .../skyhanni/features/garden/AnitaMedalProfit.kt | 7 +- .../features/garden/AtmosphericFilterDisplay.kt | 1 - .../skyhanni/features/garden/CropAccessory.kt | 6 +- .../hannibal2/skyhanni/features/garden/CropType.kt | 32 +- .../features/garden/FarmingFortuneDisplay.kt | 6 +- .../features/garden/FarmingMilestoneCommand.kt | 14 +- .../skyhanni/features/garden/GardenAPI.kt | 5 +- .../features/garden/GardenCropMilestoneFix.kt | 9 +- .../features/garden/GardenCropTimeCommand.kt | 17 +- .../features/garden/GardenCropsInCommand.kt | 19 +- .../skyhanni/features/garden/GardenLevelDisplay.kt | 19 +- .../features/garden/GardenNextJacobContest.kt | 24 +- .../skyhanni/features/garden/GardenOptimalSpeed.kt | 7 +- .../skyhanni/features/garden/GardenPlotAPI.kt | 9 +- .../skyhanni/features/garden/GardenWarpCommands.kt | 4 +- .../skyhanni/features/garden/GardenYawAndPitch.kt | 1 + .../skyhanni/features/garden/SensitivityReducer.kt | 5 +- .../skyhanni/features/garden/ToolTooltipTweaks.kt | 2 +- .../features/garden/composter/ComposterAPI.kt | 5 +- .../features/garden/composter/ComposterDisplay.kt | 10 +- .../garden/composter/ComposterInventoryNumbers.kt | 2 +- .../features/garden/composter/ComposterOverlay.kt | 40 +- .../composter/GardenComposterInventoryFeatures.kt | 6 +- .../features/garden/contest/FarmingContestAPI.kt | 7 +- .../garden/contest/JacobContestFFNeededDisplay.kt | 6 +- .../garden/contest/JacobContestStatsSummary.kt | 15 +- .../garden/contest/JacobContestTimeNeeded.kt | 11 +- .../contest/JacobFarmingContestsInventory.kt | 1 + .../features/garden/farming/ArmorDropTracker.kt | 7 +- .../features/garden/farming/CropMoneyDisplay.kt | 13 +- .../features/garden/farming/CropSpeedMeter.kt | 7 +- .../features/garden/farming/DicerRngDropTracker.kt | 8 +- .../garden/farming/FarmingWeightDisplay.kt | 20 +- .../features/garden/farming/GardenBestCropTime.kt | 7 +- .../garden/farming/GardenCropMilestoneDisplay.kt | 6 +- .../features/garden/farming/GardenCropSpeed.kt | 7 +- .../garden/farming/GardenCustomKeybinds.kt | 1 + .../features/garden/farming/GardenStartLocation.kt | 15 +- .../farming/WildStrawberryDyeNotification.kt | 4 +- .../garden/farming/WrongFungiCutterWarning.kt | 2 + .../garden/fortuneguide/CaptureFarmingGear.kt | 25 +- .../features/garden/fortuneguide/FFGuideGUI.kt | 4 +- .../features/garden/fortuneguide/FFStats.kt | 1 + .../garden/fortuneguide/FarmingReforges.kt | 4 +- .../features/garden/fortuneguide/FarmingSets.kt | 5 +- .../features/garden/fortuneguide/FortuneStats.kt | 2 +- .../features/garden/fortuneguide/FortuneUpgrade.kt | 4 +- .../garden/fortuneguide/FortuneUpgrades.kt | 17 +- .../garden/fortuneguide/pages/OverviewPage.kt | 4 +- .../garden/fortuneguide/pages/UpgradePage.kt | 1 + .../garden/inventory/AnitaExtraFarmingFortune.kt | 3 +- .../inventory/GardenCropMilestoneInventory.kt | 3 +- .../garden/inventory/GardenInventoryNumbers.kt | 2 +- .../garden/inventory/GardenNextPlotPrice.kt | 4 +- .../features/garden/inventory/GardenPlotIcon.kt | 4 +- .../garden/inventory/SkyMartCopperPrice.kt | 4 +- .../skyhanni/features/garden/pests/PestAPI.kt | 1 + .../skyhanni/features/garden/pests/PestFinder.kt | 14 +- .../skyhanni/features/garden/pests/PestSpawn.kt | 4 +- .../features/garden/pests/PestSpawnTimer.kt | 1 + .../skyhanni/features/garden/pests/SprayDisplay.kt | 5 +- .../features/garden/pests/SprayFeatures.kt | 2 +- .../skyhanni/features/garden/pests/SprayType.kt | 3 +- .../garden/visitor/GardenVisitorColorNames.kt | 1 + .../garden/visitor/GardenVisitorDropStatistics.kt | 7 +- .../garden/visitor/GardenVisitorFeatures.kt | 15 +- .../features/garden/visitor/GardenVisitorTimer.kt | 4 +- .../visitor/HighlightVisitorsOutsideOfGarden.kt | 4 +- .../features/garden/visitor/NPCVisitorFix.kt | 5 +- .../skyhanni/features/garden/visitor/VisitorAPI.kt | 11 +- .../features/garden/visitor/VisitorListener.kt | 9 +- .../features/garden/visitor/VisitorReward.kt | 8 +- .../garden/visitor/VisitorTooltipParser.kt | 2 +- .../features/inventory/AuctionsHighlighter.kt | 6 +- .../skyhanni/features/inventory/ChestValue.kt | 4 +- .../skyhanni/features/inventory/DojoRankDisplay.kt | 7 +- .../features/inventory/HideNotClickableItems.kt | 7 +- .../features/inventory/HighlightBonzoMasks.kt | 3 +- .../inventory/ItemDisplayOverlayFeatures.kt | 1 + .../skyhanni/features/inventory/ItemStars.kt | 1 - .../features/inventory/PowerStoneGuideFeatures.kt | 3 +- .../features/inventory/QuickCraftFeatures.kt | 2 +- .../features/inventory/RngMeterInventory.kt | 3 +- .../skyhanni/features/inventory/SackDisplay.kt | 5 +- .../skyhanni/features/inventory/StatsTuning.kt | 2 +- .../skyhanni/features/inventory/tiarelay/Relay.kt | 1 + .../features/inventory/tiarelay/TiaRelayHelper.kt | 8 +- .../inventory/tiarelay/TiaRelayWaypoints.kt | 1 + .../features/itemabilities/ChickenHeadTimer.kt | 1 + .../itemabilities/FireVeilWandParticles.kt | 3 +- .../itemabilities/abilitycooldown/ItemAbility.kt | 4 +- .../abilitycooldown/ItemAbilityCooldown.kt | 7 +- .../skyhanni/features/mining/DeepCavernsParkour.kt | 13 +- .../mining/HighlightMiningCommissionMobs.kt | 1 + .../skyhanni/features/mining/KingTalismanHelper.kt | 11 +- .../crystalhollows/CrystalHollowsNamesInCore.kt | 1 + .../mining/eventtracker/MiningEventTracker.kt | 4 +- .../features/mining/powdertracker/PowderTracker.kt | 9 +- .../skyhanni/features/minion/MinionCollectLogic.kt | 1 + .../skyhanni/features/minion/MinionFeatures.kt | 10 +- .../hannibal2/skyhanni/features/minion/MinionXp.kt | 3 +- .../skyhanni/features/misc/BetterSignEditing.kt | 1 + .../skyhanni/features/misc/ButtonOnPause.kt | 3 +- .../skyhanni/features/misc/CollectionTracker.kt | 17 +- .../skyhanni/features/misc/CurrentPetDisplay.kt | 1 + .../skyhanni/features/misc/CustomTextBox.kt | 5 +- .../skyhanni/features/misc/FandomWikiFromMenus.kt | 0 .../skyhanni/features/misc/FixNEUHeavyPearls.kt | 5 +- .../hannibal2/skyhanni/features/misc/HideArmor.kt | 1 + .../skyhanni/features/misc/InGameDateDisplay.kt | 5 +- .../skyhanni/features/misc/JoinCrystalHollows.kt | 9 +- .../skyhanni/features/misc/LesserOrbHider.kt | 4 +- .../skyhanni/features/misc/LimboTimeTracker.kt | 14 +- .../skyhanni/features/misc/LockMouseLook.kt | 9 +- .../skyhanni/features/misc/MarkedPlayerManager.kt | 12 +- .../skyhanni/features/misc/MovementSpeedDisplay.kt | 1 + .../features/misc/NonGodPotEffectDisplay.kt | 11 +- .../skyhanni/features/misc/ParticleHider.kt | 4 +- .../skyhanni/features/misc/PartyMemberOutlines.kt | 3 +- .../skyhanni/features/misc/PetExpTooltip.kt | 3 +- .../skyhanni/features/misc/PlayerChatSymbols.kt | 1 + .../skyhanni/features/misc/QuickModMenuSwitch.kt | 12 +- .../skyhanni/features/misc/ServerRestartTitle.kt | 1 + .../skyhanni/features/misc/SkyBlockKickDuration.kt | 1 + .../features/misc/SuperpairsClicksAlert.kt | 5 +- .../skyhanni/features/misc/TimeFeatures.kt | 1 + .../hannibal2/skyhanni/features/misc/TpsCounter.kt | 2 + .../misc/compacttablist/AdvancedPlayerList.kt | 6 +- .../features/misc/compacttablist/TabColumn.kt | 4 +- .../features/misc/compacttablist/TabListReader.kt | 1 + .../misc/compacttablist/TabListRenderer.kt | 4 +- .../features/misc/compacttablist/TabSection.kt | 3 +- .../features/misc/compacttablist/TabStringType.kt | 3 +- .../features/misc/discordrpc/DiscordRPCManager.kt | 28 +- .../features/misc/discordrpc/DiscordStatus.kt | 1 - .../misc/items/AuctionHouseCopyUnderbidPrice.kt | 4 +- .../features/misc/items/EstimatedItemValue.kt | 12 +- .../misc/items/EstimatedItemValueCalculator.kt | 8 +- .../features/misc/items/EstimatedWardrobePrice.kt | 1 + .../massconfiguration/DefaultConfigFeatures.kt | 19 +- .../massconfiguration/DefaultConfigOptionGui.kt | 6 +- .../massconfiguration/FeatureToggleableOption.kt | 4 +- .../misc/teleportpad/TeleportPadCompactName.kt | 3 +- .../misc/teleportpad/TeleportPadInventoryNumber.kt | 1 + .../features/misc/trevor/TrevorFeatures.kt | 1 + .../skyhanni/features/misc/trevor/TrevorSolver.kt | 1 + .../skyhanni/features/misc/trevor/TrevorTracker.kt | 5 +- .../misc/update/GuiOptionEditorUpdateCheck.kt | 1 + .../skyhanni/features/misc/update/UpdateManager.kt | 8 +- .../features/misc/visualwords/ModifyVisualWords.kt | 1 + .../features/misc/visualwords/VisualWord.kt | 5 +- .../features/misc/visualwords/VisualWordGui.kt | 5 +- .../skyhanni/features/nether/PabloHelper.kt | 5 +- .../skyhanni/features/nether/SulphurSkitterBox.kt | 6 +- .../features/nether/VolcanoExplosivityDisplay.kt | 3 +- .../features/nether/ashfang/AshfangBlazes.kt | 3 +- .../features/nether/ashfang/AshfangBlazingSouls.kt | 3 +- .../nether/ashfang/AshfangFreezeCooldown.kt | 1 + .../features/nether/ashfang/AshfangGravityOrbs.kt | 3 +- .../nether/ashfang/AshfangHideParticles.kt | 3 +- .../nether/ashfang/AshfangNextResetCooldown.kt | 1 + .../CrimsonIsleReputationHelper.kt | 9 +- .../dailykuudra/DailyKuudraBossHelper.kt | 6 +- .../reputationhelper/dailykuudra/KuudraTier.kt | 3 +- .../dailyquest/DailyQuestHelper.kt | 8 +- .../reputationhelper/dailyquest/QuestLoader.kt | 4 +- .../reputationhelper/dailyquest/quest/DojoQuest.kt | 2 +- .../dailyquest/quest/FetchQuest.kt | 8 +- .../dailyquest/quest/ProgressQuest.kt | 2 +- .../reputationhelper/dailyquest/quest/Quest.kt | 2 +- .../dailyquest/quest/TrophyFishQuest.kt | 2 +- .../reputationhelper/miniboss/CrimsonMiniBoss.kt | 2 +- .../miniboss/DailyMiniBossHelper.kt | 2 +- .../at/hannibal2/skyhanni/features/rift/RiftAPI.kt | 1 + .../rift/area/dreadfarm/RiftAgaricusCap.kt | 1 + .../area/dreadfarm/RiftWiltedBerberisHelper.kt | 5 +- .../rift/area/dreadfarm/VoltHighlighter.kt | 3 +- .../area/livingcave/LivingCaveDefenseBlocks.kt | 6 +- .../area/livingcave/LivingCaveLivingMetalHelper.kt | 1 + .../area/livingcave/LivingMetalSuitProgress.kt | 2 +- .../rift/area/mirrorverse/RiftLavaMazeParkour.kt | 6 +- .../rift/area/mirrorverse/RiftUpsideDownParkour.kt | 6 +- .../rift/area/mirrorverse/TubulatorParkour.kt | 8 +- .../area/stillgorechateau/RiftBloodEffigies.kt | 11 +- .../rift/area/westvillage/VerminTracker.kt | 10 +- .../rift/area/westvillage/kloon/KloonHacking.kt | 1 + .../features/rift/area/wyldwoods/RiftLarva.kt | 3 +- .../features/rift/area/wyldwoods/RiftOdonata.kt | 3 +- .../rift/area/wyldwoods/ShyCruxWarnings.kt | 1 + .../rift/everywhere/CruxTalismanDisplay.kt | 7 +- .../rift/everywhere/EnigmaSoulWaypoints.kt | 9 +- .../features/rift/everywhere/HighlightRiftGuide.kt | 3 +- .../skyhanni/features/rift/everywhere/RiftTimer.kt | 4 +- .../features/rift/everywhere/motes/RiftMotesOrb.kt | 3 +- .../rift/everywhere/motes/ShowMotesNpcSellPrice.kt | 5 +- .../features/slayer/SlayerItemsOnGround.kt | 1 + .../features/slayer/SlayerMiniBossFeatures.kt | 3 +- .../features/slayer/SlayerProfitTracker.kt | 10 +- .../skyhanni/features/slayer/SlayerQuestWarning.kt | 13 +- .../features/slayer/SlayerRngMeterDisplay.kt | 6 +- .../features/slayer/VampireSlayerFeatures.kt | 4 +- .../features/slayer/blaze/BlazeSlayerClearView.kt | 3 +- .../slayer/blaze/BlazeSlayerDaggerHelper.kt | 3 +- .../slayer/blaze/BlazeSlayerFirePitsWarning.kt | 2 + .../features/slayer/blaze/HellionShield.kt | 3 +- .../features/slayer/blaze/HellionShieldHelper.kt | 3 +- .../slayer/enderman/EndermanSlayerFeatures.kt | 11 +- .../features/stranded/HighlightPlaceableNpcs.kt | 1 + .../features/summonings/SummoningMobManager.kt | 5 +- .../features/summonings/SummoningSoulsName.kt | 6 +- .../skyhanni/mixins/hooks/FontRendererHook.kt | 4 +- .../hooks/MixinPatcherFontRendererHookHook.kt | 3 +- .../skyhanni/mixins/hooks/RenderGlobalHook.kt | 3 +- .../mixins/hooks/RenderLivingEntityHelper.kt | 7 +- .../mixins/hooks/RendererLivingEntityHook.kt | 3 +- .../skyhanni/mixins/init/SkyhanniMixinPlugin.java | 26 +- .../skyhanni/test/CommandsSendToServerLogger.kt | 3 +- .../at/hannibal2/skyhanni/test/DebugCommand.kt | 5 +- .../at/hannibal2/skyhanni/test/GriffinUtils.kt | 4 +- .../java/at/hannibal2/skyhanni/test/PacketTest.kt | 8 +- .../skyhanni/test/ParkourWaypointSaver.kt | 3 +- .../test/SkyHanniConfigSearchResetCommand.kt | 6 +- .../skyhanni/test/SkyHanniDebugsAndTests.kt | 47 ++- .../java/at/hannibal2/skyhanni/test/TestBingo.kt | 5 +- .../skyhanni/test/TestCopyBestiaryValues.kt | 3 +- .../skyhanni/test/TestCopyRngMeterValues.kt | 6 +- .../at/hannibal2/skyhanni/test/TestExportTools.kt | 5 +- .../java/at/hannibal2/skyhanni/test/WorldEdit.kt | 17 +- .../skyhanni/test/command/CopyItemCommand.kt | 6 +- .../test/command/CopyNearbyEntitiesCommand.kt | 8 +- .../test/command/CopyNearbyParticlesCommand.kt | 7 +- .../skyhanni/test/command/CopyScoreboardCommand.kt | 7 +- .../skyhanni/test/command/ErrorManager.kt | 11 +- .../skyhanni/test/command/TestChatCommand.kt | 9 +- .../skyhanni/test/hotswap/HotswapSupport.kt | 1 + .../skyhanni/test/hotswap/HotswapSupportHandle.kt | 1 + .../skyhanni/test/hotswap/HotswapSupportImpl.kt | 15 +- .../java/at/hannibal2/skyhanni/utils/APIUtil.kt | 27 +- .../java/at/hannibal2/skyhanni/utils/ChatUtils.kt | 203 ++++++++++ .../at/hannibal2/skyhanni/utils/ClipboardUtils.kt | 3 +- .../at/hannibal2/skyhanni/utils/CollectionUtils.kt | 115 ++++++ .../java/at/hannibal2/skyhanni/utils/ColorUtils.kt | 7 +- .../at/hannibal2/skyhanni/utils/CombatUtils.kt | 1 - .../hannibal2/skyhanni/utils/ConditionalUtils.kt | 33 ++ .../at/hannibal2/skyhanni/utils/ConfigUtils.kt | 2 +- .../java/at/hannibal2/skyhanni/utils/DelayedRun.kt | 3 +- .../skyhanni/utils/EntityOutlineRenderer.kt | 3 +- .../at/hannibal2/skyhanni/utils/EntityUtils.kt | 4 +- .../at/hannibal2/skyhanni/utils/GuiRenderUtils.kt | 8 +- .../skyhanni/utils/IdentityCharacteristics.kt | 1 + .../at/hannibal2/skyhanni/utils/InventoryUtils.kt | 4 +- .../java/at/hannibal2/skyhanni/utils/ItemBlink.kt | 3 +- .../skyhanni/utils/ItemStackTypeAdapter.kt | 4 +- .../java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 4 +- .../at/hannibal2/skyhanni/utils/KSerializable.kt | 6 +- .../at/hannibal2/skyhanni/utils/KeyboardManager.kt | 1 + .../at/hannibal2/skyhanni/utils/LorenzColor.kt | 1 + .../at/hannibal2/skyhanni/utils/LorenzDebug.kt | 4 +- .../at/hannibal2/skyhanni/utils/LorenzLogger.kt | 2 + .../at/hannibal2/skyhanni/utils/LorenzUtils.kt | 435 ++------------------- .../java/at/hannibal2/skyhanni/utils/LorenzVec.kt | 1 + .../skyhanni/utils/MinecraftConsoleFilter.kt | 5 +- .../skyhanni/utils/MinecraftDispatcher.kt | 3 +- .../at/hannibal2/skyhanni/utils/MultiFilter.kt | 2 +- .../at/hannibal2/skyhanni/utils/NBTTypeAdapter.kt | 3 +- .../at/hannibal2/skyhanni/utils/NEUInternalName.kt | 3 +- .../java/at/hannibal2/skyhanni/utils/NEUItems.kt | 3 +- .../java/at/hannibal2/skyhanni/utils/NumberUtil.kt | 7 +- .../java/at/hannibal2/skyhanni/utils/OSUtils.kt | 2 +- .../at/hannibal2/skyhanni/utils/ParkourHelper.kt | 6 +- .../hannibal2/skyhanni/utils/RecalculatingValue.kt | 3 +- .../at/hannibal2/skyhanni/utils/ReflectionUtils.kt | 62 +++ .../at/hannibal2/skyhanni/utils/RenderUtils.kt | 28 +- .../java/at/hannibal2/skyhanni/utils/Season.kt | 4 +- .../at/hannibal2/skyhanni/utils/SimpleTimeMark.kt | 1 + .../skyhanni/utils/SkyBlockItemModifierUtils.kt | 9 +- .../java/at/hannibal2/skyhanni/utils/SoundUtils.kt | 3 +- .../at/hannibal2/skyhanni/utils/StringUtils.kt | 1 + .../at/hannibal2/skyhanni/utils/TabListData.kt | 20 +- .../java/at/hannibal2/skyhanni/utils/TimeMark.kt | 4 +- .../java/at/hannibal2/skyhanni/utils/TimeUtils.kt | 9 +- src/main/java/at/hannibal2/skyhanni/utils/Timer.kt | 3 +- .../at/hannibal2/skyhanni/utils/UtilsPatterns.kt | 4 +- .../utils/renderables/RenderLineTooltips.kt | 4 +- .../skyhanni/utils/renderables/Renderable.kt | 2 + .../skyhanni/utils/repopatterns/RepoPattern.kt | 3 +- .../utils/repopatterns/RepoPatternGroup.kt | 1 + .../skyhanni/utils/repopatterns/RepoPatternGui.kt | 6 +- .../skyhanni/utils/repopatterns/RepoPatternImpl.kt | 2 +- .../utils/repopatterns/RepoPatternManager.kt | 4 +- .../skyhanni/utils/shader/ShaderHelper.kt | 2 + .../skyhanni/utils/shader/ShaderManager.kt | 2 + .../at/hannibal2/skyhanni/utils/shader/Uniform.kt | 5 +- .../skyhanni/utils/tracker/ItemTrackerData.kt | 1 + .../skyhanni/utils/tracker/SkyHanniItemTracker.kt | 15 +- .../skyhanni/utils/tracker/SkyHanniTracker.kt | 10 +- .../skyhanni/utils/tracker/TrackerData.kt | 1 + .../at/hannibal2/skyhanni/test/BootstrapHook.kt | 5 +- 479 files changed, 2032 insertions(+), 1460 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/FandomWikiFromMenus.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/ConditionalUtils.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/ReflectionUtils.kt diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt index 3336fcae3..ff744cecd 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt @@ -4,10 +4,10 @@ import at.hannibal2.skyhanni.events.CollectionUpdateEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.ItemAddEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull @@ -17,6 +17,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CollectionAPI { + // TODO USE SH-REPO private val counterPattern = ".* §e(?.*)§6/.*".toPattern() private val singleCounterPattern = "§7Total Collected: §e(?.*)".toPattern() @@ -76,13 +77,14 @@ class CollectionAPI { // TODO add support for replenish (higher collection than actual items in inv) if (internalName.getItemStackOrNull() == null) { - LorenzUtils.debug("CollectionAPI.addFromInventory: item is null for '$internalName'") + ChatUtils.debug("CollectionAPI.addFromInventory: item is null for '$internalName'") return } collectionValue.addOrPut(internalName, event.amount.toLong()) } companion object { + // TODO USE SH-REPO val collectionValue = mutableMapOf() private val collectionTier0Pattern = "§7Progress to .* I: .*".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt index b0adea115..fd1fac07d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt @@ -11,6 +11,7 @@ import java.io.IOException @Suppress("unused") class ConfigGuiForgeInterop : IModGuiFactory { + override fun initialize(minecraft: Minecraft) {} override fun mainConfigGuiClass() = WrappedSkyHanniConfig::class.java @@ -20,6 +21,7 @@ class ConfigGuiForgeInterop : IModGuiFactory { class WrappedSkyHanniConfig(private val parent: GuiScreen) : GuiScreenElementWrapper(ConfigGuiManager.getEditorInstance()) { + @Throws(IOException::class) override fun handleKeyboardInput() { if (Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt index f6bcd3bbc..fe43a8f82 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt @@ -18,5 +18,4 @@ object ConfigGuiManager { } SkyHanniMod.screenToOpen = GuiScreenElementWrapper(editor) } - } diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index b69c90a59..125d395f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -46,6 +46,7 @@ typealias TrackerDisplayMode = SkyHanniTracker.DefaultDisplayMode class ConfigManager { companion object { + val gson = GsonBuilder().setPrettyPrinting() .excludeFieldsWithoutExposeAnnotation() .serializeSpecialFloatingPointValues() diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index 436132cd3..64a158d10 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -8,6 +8,7 @@ import com.google.gson.JsonObject import com.google.gson.JsonPrimitive object ConfigUpdaterMigrator { + val logger = LorenzLogger("ConfigMigration") const val CONFIG_VERSION = 23 fun JsonElement.at(chain: List, init: Boolean): JsonElement? { @@ -28,6 +29,7 @@ object ConfigUpdaterMigrator { var movesPerformed: Int, val dynamicPrefix: Map>, ) : LorenzEvent() { + init { dynamicPrefix.entries.filter { it.value.isEmpty() }.forEach { logger.log("Dynamic prefix ${it.key} does not resolve to anything.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/SackData.java b/src/main/java/at/hannibal2/skyhanni/config/SackData.java index 61febed74..3495f9b8c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/SackData.java +++ b/src/main/java/at/hannibal2/skyhanni/config/SackData.java @@ -23,4 +23,4 @@ public class SackData { @Expose public Map sackContents = new HashMap<>(); } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index a9364d695..56a11626a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -135,9 +135,9 @@ public class Storage { @Override public String toString() { return "MinionConfig{" + - "displayName='" + displayName + '\'' + - ", lastClicked=" + lastClicked + - '}'; + "displayName='" + displayName + '\'' + + ", lastClicked=" + lastClicked + + '}'; } } @@ -395,11 +395,11 @@ public class Storage { @Override public String toString() { return "SlayerRngMeterStorage{" + - "currentMeter=" + currentMeter + - ", gainPerBoss=" + gainPerBoss + - ", goalNeeded=" + goalNeeded + - ", itemGoal='" + itemGoal + '\'' + - '}'; + "currentMeter=" + currentMeter + + ", gainPerBoss=" + gainPerBoss + + ", goalNeeded=" + goalNeeded + + ", itemGoal='" + itemGoal + '\'' + + '}'; } } 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 e2868a931..6e7c80ce1 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -65,6 +65,7 @@ import at.hannibal2.skyhanni.test.command.CopyScoreboardCommand import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.test.command.TestChatCommand import at.hannibal2.skyhanni.utils.APIUtil +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.TabListData @@ -482,7 +483,7 @@ object Commands { @JvmStatic fun openFortuneGuide() { if (!LorenzUtils.inSkyBlock) { - LorenzUtils.userError("Join SkyBlock to open the fortune guide!") + ChatUtils.userError("Join SkyBlock to open the fortune guide!") } else { CaptureFarmingGear.captureFarmingGear() SkyHanniMod.screenToOpen = FFGuideGUI() @@ -492,7 +493,7 @@ object Commands { @JvmStatic fun openVisualWords() { if (!LorenzUtils.onHypixel) { - LorenzUtils.userError("You need to join Hypixel to use this feature!") + ChatUtils.userError("You need to join Hypixel to use this feature!") } else { if (VisualWordGui.sbeConfigPath.exists()) VisualWordGui.drawImport = true SkyHanniMod.screenToOpen = VisualWordGui() @@ -501,7 +502,7 @@ object Commands { private fun clearFarmingItems() { val storage = GardenAPI.storage?.fortune ?: return - LorenzUtils.chat("clearing farming items") + ChatUtils.chat("clearing farming items") storage.farmingItems.clear() storage.outdatedItems.clear() } diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt index bca46dbd6..b8a5871b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt @@ -6,6 +6,7 @@ import net.minecraft.command.ICommandSender import net.minecraft.util.BlockPos class SimpleCommand : CommandBase { + private val commandName: String private val runnable: ProcessCommandRunnable private var tabRunnable: TabCompleteRunnable? = null @@ -22,10 +23,12 @@ class SimpleCommand : CommandBase { } abstract class ProcessCommandRunnable { + abstract fun processCommand(sender: ICommandSender?, args: Array?) } interface TabCompleteRunnable { + fun tabComplete(sender: ICommandSender?, args: Array?, pos: BlockPos?): List } 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 88ec9e054..f6765ca2b 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 @@ -35,6 +35,7 @@ import org.lwjgl.input.Mouse import java.io.IOException class GuiPositionEditor(private val positions: List, private val border: Int) : GuiScreen() { + private var grabbedX = 0 private var grabbedY = 0 private var clickedPos = -1 diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java index 4e9a351a7..e46d8052a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java @@ -7,9 +7,10 @@ import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind; import io.github.moulberry.moulconfig.annotations.ConfigOption; +import org.lwjgl.input.Keyboard; + import java.util.ArrayList; import java.util.List; -import org.lwjgl.input.Keyboard; public class ChatConfig { diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/SulphurSkitterBoxConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/SulphurSkitterBoxConfig.java index 9577a9146..c37b16172 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/SulphurSkitterBoxConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/SulphurSkitterBoxConfig.java @@ -1,14 +1,11 @@ package at.hannibal2.skyhanni.config.features.crimsonisle; import at.hannibal2.skyhanni.config.FeatureToggle; -import at.hannibal2.skyhanni.config.HasLegacyId; -import at.hannibal2.skyhanni.features.nether.SulphurSkitterBox; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorColour; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; import io.github.moulberry.moulconfig.annotations.ConfigOption; -import io.github.moulberry.moulconfig.observer.Property; public class SulphurSkitterBoxConfig { diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java index 19cd42a16..c9be39d54 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java @@ -12,7 +12,18 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.*; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.ACCEPTED; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.COINS_SPENT; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.COPPER; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.DEDICATION_IV; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.DENIED; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.FARMING_EXP; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.GREEN_BANDANA; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.OVERGROWN_GRASS; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.SPACER_1; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.TITLE; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.TOTAL_VISITORS; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.VISITORS_BY_RARITY; public class DropsStatisticsConfig { diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java index fc7bac1e1..499514e2f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java @@ -239,7 +239,7 @@ public class MiscConfig { @Expose @ConfigOption(name = "Fix Ghost Entities", desc = "Removes ghost entities caused by a Hypixel bug. " + - "This included Diana, Dungeon and Crimson Isle mobs and nametags.") + "This included Diana, Dungeon and Crimson Isle mobs and nametags.") @ConfigEditorBoolean @FeatureToggle public boolean fixGhostEntities = true; diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java index dc1919042..2103968e6 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java @@ -8,6 +8,7 @@ import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; import io.github.moulberry.moulconfig.annotations.ConfigOption; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt index 08bef76ff..d631e8e26 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt @@ -9,8 +9,7 @@ import at.hannibal2.skyhanni.features.chat.ChatFilterGui import at.hannibal2.skyhanni.utils.IdentityCharacteristics import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.chat -import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible +import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible import net.minecraft.client.Minecraft import net.minecraft.client.gui.ChatLine import net.minecraft.client.gui.GuiNewChat @@ -54,6 +53,7 @@ object ChatManager { val renderedString = "$format$name" companion object { + val maxLength by lazy { entries.maxOf { Minecraft.getMinecraft().fontRendererObj.getStringWidth(it.renderedString) } } @@ -64,7 +64,7 @@ object ChatManager { val message: IChatComponent, var actionKind: ActionKind, var actionReason: String?, - val modified: IChatComponent? + val modified: IChatComponent?, ) @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) @@ -77,7 +77,6 @@ object ChatManager { val actionBarEvent = LorenzActionBarEvent(message) actionBarEvent.postAndCatch() } - } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt index ad5d01d3c..9ea5742a1 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt @@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream import java.util.Base64 class CropAccessoryData { + // TODO USE SH-REPO private val accessoryBagNamePattern = "Accessory Bag \\((?\\d)/(?\\d)\\)".toPattern() private var loadedAccessoryThisProfile = false @@ -89,12 +90,12 @@ class CropAccessoryData { } } - private fun bestCropAccessory(items: Iterable) = items.mapNotNull { item -> CropAccessory.getByName(item.getInternalName()) } .maxOrNull() ?: CropAccessory.NONE companion object { + var accessoryBagPageCount = 0 private set diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt index dec06dc8e..ae5a03878 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt @@ -13,6 +13,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class EntityMovementData { companion object { + private val entityLocation = mutableMapOf() fun addToTrack(entity: Entity) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt b/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt index 70de5e436..f7a730a65 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt @@ -1,13 +1,14 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark import kotlin.time.Duration.Companion.seconds object EventCounter { + private val config get() = SkyHanniMod.feature.dev.debug private var map = mutableMapOf() diff --git a/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt index 834ccaa55..c9cfcc62f 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt @@ -15,6 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.UUID object FriendAPI { + // TODO USE SH-REPO private val removedFriendPattern = ".*\n§r§eYou removed §r(?.*)§e from your friends list!§r§9§m\n.*".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt index 34baceb0b..dfa275cb7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent @@ -8,11 +9,11 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GardenCropMilestones { + // TODO USE SH-REPO private val cropPattern = "§7Harvest §f(?.*) §7on .*".toPattern() val totalPattern = "§7Total: §a(?.*)".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt index 71398af27..950f226f1 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt @@ -6,11 +6,12 @@ import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy -import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary @@ -23,6 +24,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GardenCropMilestonesCommunityFix { + private val pattern = ".*§e(?.*)§6/§e(?.*)".toPattern() private var showWrongData = false private var showWhenAllCorrect = false @@ -55,7 +57,7 @@ object GardenCropMilestonesCommunityFix { } if (data.isNotEmpty()) { - LorenzUtils.chat( + ChatUtils.chat( "Found §c${data.size} §ewrong crop milestone steps in the menu! " + "Correct data got put into clipboard. " + "Please share it on the §bSkyHanni Discord §ein the channel §b#share-data§e." @@ -63,7 +65,7 @@ object GardenCropMilestonesCommunityFix { OSUtils.copyToClipboard("```${data.joinToString("\n")}```") } else { if (showWhenAllCorrect) { - LorenzUtils.chat("No wrong crop milestone steps found!") + ChatUtils.chat("No wrong crop milestone steps found!") } } } @@ -71,7 +73,7 @@ object GardenCropMilestonesCommunityFix { private fun checkForWrongData( stack: ItemStack, crop: CropType, - wrongData: MutableList + wrongData: MutableList, ) { val name = stack.name ?: return val rawNumber = name.removeColor().replace(crop.cropName, "").trim() @@ -151,7 +153,7 @@ object GardenCropMilestonesCommunityFix { } } totalFixedValues += fixed - LorenzUtils.chat("Fixed: $fixed/$alreadyCorrect, total fixes: $totalFixedValues") + ChatUtils.chat("Fixed: $fixed/$alreadyCorrect, total fixes: $totalFixedValues") val s = ConfigManager.gson.toJsonTree(GardenCropMilestones.cropMilestoneData).toString() OSUtils.copyToClipboard("\"crop_milestones\":$s,") } diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt index 1ea0871ee..c15299ab3 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class 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() @@ -39,6 +40,7 @@ class GardenCropUpgrades { } companion object { + private val cropUpgrades: MutableMap? get() = GardenAPI.storage?.cropUpgrades fun CropType.getUpgradeLevel() = cropUpgrades?.get(this) @@ -46,6 +48,5 @@ class GardenCropUpgrades { 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 0f1da835b..9c50b1c09 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -6,10 +6,11 @@ import at.hannibal2.skyhanni.config.core.config.gui.GuiPositionEditor import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.getPropertiesWithType import at.hannibal2.skyhanni.utils.LorenzUtils.isRancherSign import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.ReflectionUtils.getPropertiesWithType import at.hannibal2.skyhanni.utils.SimpleTimeMark import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer @@ -78,7 +79,7 @@ class GuiEditManager { SkyHanniMod.screenToOpen = GuiPositionEditor(latestPositions.values.toList(), 2) if (hotkeyReminder && lastHotkeyReminded.passedSince() > 30.minutes) { lastHotkeyReminded = SimpleTimeMark.now() - LorenzUtils.chat( + 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." @@ -116,7 +117,7 @@ class GuiEditManager { fun Position.getAbsY() = getAbsY0(getDummySize(true).y) fun GuiProfileViewer.anyTextBoxFocused() = - this.getPropertiesWithType().any{it.focus} + this.getPropertiesWithType().any { it.focus } } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt index 5a4fb4f99..f4273e745 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuildAPI.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GuildAPI { + private var inGuildMessage = false private val list = mutableListOf() diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 3f6ec7051..57889cc48 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -26,6 +27,7 @@ import net.minecraftforge.fml.common.network.FMLNetworkEvent import kotlin.concurrent.thread class HypixelData { + private val patternGroup = RepoPattern.group("data.hypixeldata") private val tabListProfilePattern by patternGroup.pattern( "tablistprofile", @@ -43,6 +45,7 @@ class HypixelData { private var lastLocRaw = 0L companion object { + private val patternGroup = RepoPattern.group("data.hypixeldata") private val serverIdScoreboardPattern by patternGroup.pattern( "serverid.scoreboard", @@ -61,7 +64,7 @@ class HypixelData { var skyBlockIsland = IslandType.UNKNOWN var serverId: String? = null - //Ironman, Stranded and Bingo + // Ironman, Stranded and Bingo var noTrade = false var ironman = false @@ -95,16 +98,20 @@ class HypixelData { if (!LorenzUtils.inSkyBlock) return null if (serverId != null) return serverId - ScoreboardData.sidebarLinesFormatted.forEach { serverIdScoreboardPattern.matchMatcher(it) { - val serverType = if (group("servertype") == "M") "mega" else "mini" - serverId = "$serverType${group("serverid")}" - return serverId - } } + ScoreboardData.sidebarLinesFormatted.forEach { + serverIdScoreboardPattern.matchMatcher(it) { + val serverType = if (group("servertype") == "M") "mega" else "mini" + serverId = "$serverType${group("serverid")}" + return serverId + } + } - TabListData.getTabList().forEach { serverIdTablistPattern.matchMatcher(it) { - serverId = group("serverid") - return serverId - } } + TabListData.getTabList().forEach { + serverIdTablistPattern.matchMatcher(it) { + serverId = group("serverid") + return serverId + } + } return serverId } @@ -262,7 +269,7 @@ class HypixelData { if (skyBlockIsland != islandType) { IslandChangeEvent(islandType, skyBlockIsland).postAndCatch() if (islandType == IslandType.UNKNOWN) { - LorenzUtils.debug("Unknown island detected: '$newIsland'") + ChatUtils.debug("Unknown island detected: '$newIsland'") loggerIslandChange.log("Unknown: '$newIsland'") } else { loggerIslandChange.log(islandType.name) diff --git a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt index a3eef5dd9..e6a01136c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt @@ -17,7 +17,7 @@ enum class IslandType(val displayName: String, val modeName: String = "null") { CRYSTAL_HOLLOWS("Crystal Hollows"), THE_PARK("The Park", "floating_islands_1"), DEEP_CAVERNS("Deep Caverns", "deep_caverns"), - GOLD_MINES("Gold Mine", "gold_mine"),//TODO confirm + GOLD_MINES("Gold Mine", "gold_mine"),// TODO confirm GARDEN("Garden"), GARDEN_GUEST("Garden Guest"), SPIDER_DEN("Spider's Den"), @@ -29,6 +29,7 @@ enum class IslandType(val displayName: String, val modeName: String = "null") { ; companion object { + fun getByNameOrUnknown(name: String) = getByNameOrNull(name) ?: UNKNOWN fun getByName(name: String) = getByNameOrNull(name) ?: error("IslandType not found: '$name'") diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt index f62ebd800..406901b9d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemRenderBackground.kt @@ -38,7 +38,6 @@ class ItemRenderBackground { } } - @SubscribeEvent fun renderOverlayLol(event: RenderRealOverlayEvent) { val stack = event.stack @@ -70,4 +69,4 @@ class ItemRenderBackground { GlStateManager.popMatrix() } } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt b/src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt index f32256031..728678824 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/LocationFixData.kt @@ -1,13 +1,14 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.data.jsonobjects.repo.LocationFixJson import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside -import at.hannibal2.skyhanni.data.jsonobjects.repo.LocationFixJson import net.minecraft.util.AxisAlignedBB import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object LocationFixData { + private var locationFixes = mutableListOf() class LocationFix(val island: IslandType, val area: AxisAlignedBB, val realLocation: String) diff --git a/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt b/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt index 646337a27..e8abad8a9 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt @@ -5,8 +5,8 @@ import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.jsonobjects.local.MayorJson import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.APIUtil +import at.hannibal2.skyhanni.utils.CollectionUtils.put import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.put import at.hannibal2.skyhanni.utils.SimpleTimeMark import io.github.moulberry.notenoughupdates.util.SkyBlockTime import kotlinx.coroutines.Dispatchers @@ -16,10 +16,12 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes class MayorElection { + private var lastUpdate = SimpleTimeMark.farPast() private var dispatcher = Dispatchers.IO companion object { + var rawMayorData: MayorJson? = null var candidates = mapOf() var currentCandidate: MayorJson.Candidate? = null diff --git a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt index fa8494dcb..72395b4fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt @@ -13,6 +13,7 @@ import net.minecraft.network.play.server.S2FPacketSetSlot import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object OtherInventoryData { + private var currentInventory: Inventory? = null private var acceptItems = false private var lateEvent: InventoryUpdatedEvent? = null @@ -105,6 +106,6 @@ object OtherInventoryData { val title: String, val slotCount: Int, val items: MutableMap = mutableMapOf(), - var fullyOpenedOnce: Boolean = false + var fullyOpenedOnce: Boolean = false, ) } diff --git a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt index 97065766e..824b895bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt @@ -7,12 +7,12 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.entity.ItemAddInInventoryEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getItemName import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -26,6 +26,7 @@ import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds class OwnInventoryData { + private var itemAmounts = mapOf() private var dirty = false private val sackToInventoryChatPattern by RepoPattern.pattern( diff --git a/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt index daac67f16..22fb8e4f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName @@ -13,6 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.random.Random object PartyAPI { + private val patternGroup = RepoPattern.group("data.party") private val youJoinedPartyPattern by patternGroup.pattern( "you.joined", @@ -76,17 +78,17 @@ object PartyAPI { fun listMembers() { val size = partyMembers.size if (size == 0) { - LorenzUtils.chat("No tracked party members!") + ChatUtils.chat("No tracked party members!") return } - LorenzUtils.chat("Tracked party members §7($size) §f:", prefixColor = "§a") + ChatUtils.chat("Tracked party members §7($size) §f:", prefixColor = "§a") for (member in partyMembers) { - LorenzUtils.chat(" §a- §7$member", false) + ChatUtils.chat(" §a- §7$member", false) } if (Random.nextDouble() < 0.1) { OSUtils.openBrowser("https://www.youtube.com/watch?v=iANP7ib7CPA") - LorenzUtils.hoverableChat("§7Are You Ready To Party?", listOf("§b~Spongebob"), prefix = false) + ChatUtils.hoverableChat("§7Are You Ready To Party?", listOf("§b~Spongebob"), prefix = false) } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt index 8e6f9bb7d..e4b54115c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt @@ -11,12 +11,14 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PreProfileSwitchEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object ProfileStorageData { + var playerSpecific: Storage.PlayerSpecific? = null var profileSpecific: Storage.ProfileSpecific? = null var loaded = false @@ -47,11 +49,11 @@ object ProfileStorageData { val playerSpecific = playerSpecific val sackPlayers = sackPlayers if (playerSpecific == null) { - LorenzUtils.error("profileSpecific after profile swap can not be set: playerSpecific is null!") + ChatUtils.error("profileSpecific after profile swap can not be set: playerSpecific is null!") return } if (sackPlayers == null) { - LorenzUtils.error("sackPlayers after profile swap can not be set: sackPlayers is null!") + ChatUtils.error("sackPlayers after profile swap can not be set: sackPlayers is null!") return } loadProfileSpecific(playerSpecific, sackPlayers, profileName) @@ -63,11 +65,11 @@ object ProfileStorageData { val playerSpecific = playerSpecific val sackPlayers = sackPlayers if (playerSpecific == null) { - LorenzUtils.error("playerSpecific is null in ProfileJoinEvent!") + ChatUtils.error("playerSpecific is null in ProfileJoinEvent!") return } if (sackPlayers == null) { - LorenzUtils.error("sackPlayers is null in sackPlayers!") + ChatUtils.error("sackPlayers is null in sackPlayers!") return } @@ -104,7 +106,7 @@ object ProfileStorageData { if (System.currentTimeMillis() > noTabListTime + 3_000) { noTabListTime = System.currentTimeMillis() - LorenzUtils.chat( + ChatUtils.chat( "Extra Information from Tab list not found! " + "Enable it: SkyBlock Menu ➜ Settings ➜ Personal ➜ User Interface ➜ Player List Info" ) @@ -114,7 +116,7 @@ object ProfileStorageData { private fun loadProfileSpecific( playerSpecific: Storage.PlayerSpecific, sackProfile: SackData.PlayerSpecific, - profileName: String + profileName: String, ) { noTabListTime = -1 profileSpecific = playerSpecific.profiles.getOrPut(profileName) { Storage.ProfileSpecific() } diff --git a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt index 0deb53164..e5f226945 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt @@ -11,6 +11,7 @@ import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PurseAPI { + // TODO USE SH-REPO private val pattern = "(Piggy|Purse): §6(?[\\d,]*).*".toPattern() private var currentPurse = 0.0 diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt index 917ea9f5d..2ca07b16c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt @@ -24,9 +24,9 @@ class RenderData { if (!SkyHanniDebugsAndTests.globalRender) return if (GuiEditManager.isInGui() || VisualWordGui.isInGui()) return - GlStateManager.translate(0f,0f,-3f) + GlStateManager.translate(0f, 0f, -3f) GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch() - GlStateManager.translate(0f,0f,3f) + GlStateManager.translate(0f, 0f, 3f) } @SubscribeEvent @@ -40,9 +40,9 @@ class RenderData { GlStateManager.enableDepth() if (GuiEditManager.isInGui()) { - GlStateManager.translate(0f,0f,-3f) + GlStateManager.translate(0f, 0f, -3f) GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch() - GlStateManager.translate(0f,0f,3f) + GlStateManager.translate(0f, 0f, 3f) } GuiRenderEvent.ChestGuiOverlayRenderEvent().postAndCatch() diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt index fe6dc189d..ee9ea621c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt @@ -11,11 +11,11 @@ import at.hannibal2.skyhanni.events.SackDataUpdateEvent import at.hannibal2.skyhanni.features.fishing.FishingAPI import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity import at.hannibal2.skyhanni.features.inventory.SackDisplay +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull @@ -30,6 +30,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object SackAPI { + private val sackDisplayConfig get() = SkyHanniMod.feature.inventory.sackDisplay private val chatConfig get() = SkyHanniMod.feature.chat private var lastOpenedInventory = "" @@ -337,12 +338,12 @@ object SackAPI { data class SackItem( @Expose val amount: Long, @Expose val lastChange: Int, - @Expose private val status: SackStatus? + @Expose private val status: SackStatus?, ) { + fun getStatus() = status ?: SackStatus.MISSING } - private val gemstoneMap = mapOf( "Jade Gemstones" to "ROUGH_JADE_GEM".asInternalName(), "Amber Gemstones" to "ROUGH_AMBER_GEM".asInternalName(), @@ -356,6 +357,7 @@ private val gemstoneMap = mapOf( // ideally should be correct but using alright should also be fine unless they sold their whole sacks enum class SackStatus { + MISSING, CORRECT, ALRIGHT, diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt index 71d84328c..661330f92 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt @@ -12,6 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ScoreboardData { companion object { + // TODO USE SH-REPO private val splitIcons = listOf( "\uD83C\uDF6B", @@ -93,4 +94,4 @@ class ScoreboardData { ScorePlayerTeam.formatPlayerName(scoreboard.getPlayersTeam(it.playerName), it.playerName) } } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt index d2726c3aa..f7915a94c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SkillExperience { + // TODO USE SH-REPO private val actionBarPattern = ".*§3\\+.* (?.*) \\((?.*)/(?.*)\\).*".toPattern() private val inventoryPattern = ".* §e(?.*)§6/.*".toPattern() @@ -79,6 +80,7 @@ class SkillExperience { } companion object { + private val skillExp = mutableMapOf() private fun getLevelForExpExactly(experience: Long): Int { @@ -109,7 +111,7 @@ class SkillExperience { return 0 } - //TODO create additional event + // TODO create additional event fun getExpForSkill(skillName: String) = skillExp[skillName.lowercase()] ?: 0 private val levelingExp = listOf( diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt index ddb5943a0..64d1f6206 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt @@ -7,9 +7,9 @@ import at.hannibal2.skyhanni.events.SlayerChangeEvent import at.hannibal2.skyhanni.events.SlayerProgressChangeEvent import at.hannibal2.skyhanni.events.SlayerQuestCompleteEvent import at.hannibal2.skyhanni.features.slayer.SlayerType +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt index 6dd0c6725..6b904bc37 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.PreProfileSwitchEvent -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import io.github.moulberry.moulconfig.internal.TextRenderUtils import net.minecraft.client.Minecraft @@ -16,6 +16,7 @@ import kotlin.time.Duration.Companion.seconds class TitleManager { companion object { + private var originalText = "" private var display = "" private var endTime = SimpleTimeMark.farPast() @@ -38,7 +39,7 @@ class TitleManager { fun command(args: Array) { if (args.size < 4) { - LorenzUtils.userError("Usage: /shsendtitle ") + ChatUtils.userError("Usage: /shsendtitle ") return } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt index 3b8f6b7a7..3d3c9fd58 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt @@ -36,6 +36,7 @@ class ToolTipData { } companion object { + var lastSlot: Slot? = null } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt index cea3a5c2f..b59d31394 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TrackerManager.kt @@ -5,8 +5,8 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.misc.TrackerConfig.PriceFromEntry import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.ConfigUtils -import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -18,7 +18,7 @@ object TrackerManager { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { val config = SkyHanniMod.feature.misc.tracker.hideCheapItems - LorenzUtils.onToggle(config.alwaysShowBest, config.minPrice, config.enabled) { + ConditionalUtils.onToggle(config.alwaysShowBest, config.minPrice, config.enabled) { hasChanged = true } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java index dc2b4a5ac..8ea6d8ef6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ContributorListJson.java @@ -1,4 +1,5 @@ package at.hannibal2.skyhanni.data.jsonobjects.repo; + import com.google.gson.annotations.Expose; import java.util.List; diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java index be015722a..dd00add03 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/GardenJson.java @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.data.jsonobjects.repo; import at.hannibal2.skyhanni.features.garden.CropType; -import at.hannibal2.skyhanni.utils.NEUInternalName; import at.hannibal2.skyhanni.utils.LorenzRarity; import at.hannibal2.skyhanni.utils.LorenzVec; +import at.hannibal2.skyhanni.utils.NEUInternalName; import com.google.gson.annotations.Expose; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java index ad1aeb2e3..87b5e4e00 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java @@ -5,7 +5,6 @@ import com.google.gson.annotations.Expose; import java.util.List; import java.util.Map; -import java.util.Set; public class ItemsJson { @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt b/src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt index 627bfdef7..ecb26b37c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/model/ComposterUpgrade.kt @@ -9,6 +9,7 @@ enum class ComposterUpgrade(val displayName: String, val slotNumber: Int) { ; companion object { + private fun regexValues() = entries.joinToString("|") { it.displayName } // TODO USE SH-REPO diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt index b686602bb..021dd183b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import com.google.gson.JsonObject @@ -26,6 +27,7 @@ import java.util.concurrent.atomic.AtomicBoolean import kotlin.time.Duration.Companion.minutes class RepoManager(private val configLocation: File) { + private val gson get() = ConfigManager.gson private var latestRepoCommit: String? = null private val repoLocation: File = File(configLocation, "repo") @@ -33,6 +35,7 @@ class RepoManager(private val configLocation: File) { private var lastRepoUpdate = SimpleTimeMark.farPast() companion object { + val successfulConstants = mutableListOf() val unsuccessfulConstants = mutableListOf() @@ -55,7 +58,7 @@ class RepoManager(private val configLocation: File) { } } - private val atomicShouldManuallyReload = AtomicBoolean(false)//TODO remove the workaround + private val atomicShouldManuallyReload = AtomicBoolean(false)// TODO remove the workaround fun updateRepo() { atomicShouldManuallyReload.set(true) @@ -87,7 +90,7 @@ class RepoManager(private val configLocation: File) { ) { if (unsuccessfulConstants.isEmpty() && lastRepoUpdate.passedSince() < 1.minutes) { if (command) { - LorenzUtils.chat("§7The repo is already up to date!") + ChatUtils.chat("§7The repo is already up to date!") atomicShouldManuallyReload.set(false) } return@supplyAsync false @@ -119,7 +122,7 @@ class RepoManager(private val configLocation: File) { e ).printStackTrace() if (command) { - LorenzUtils.error("An error occurred while trying to reload the repo! See logs for more info.") + ChatUtils.error("An error occurred while trying to reload the repo! See logs for more info.") } return@supplyAsync false } @@ -161,10 +164,10 @@ class RepoManager(private val configLocation: File) { } comp.complete(null) if (answerMessage.isNotEmpty() && !error) { - LorenzUtils.chat("§a$answerMessage") + ChatUtils.chat("§a$answerMessage") } if (error) { - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "Error with the repo detected, try /shupdaterepo to fix it!", "shupdaterepo", prefixColor = "§c" @@ -204,33 +207,34 @@ class RepoManager(private val configLocation: File) { fun displayRepoStatus(joinEvent: Boolean) { if (joinEvent) { if (unsuccessfulConstants.isNotEmpty()) { - LorenzUtils.error( + ChatUtils.error( "§7Repo Issue! Some features may not work. Please report this error on the Discord!\n" + "§7Repo Auto Update Value: §c${SkyHanniMod.feature.dev.repoAutoUpdate}\n" + "§7If you have Repo Auto Update turned off, please try turning that on.\n" + "§cUnsuccessful Constants §7(${unsuccessfulConstants.size}):" ) for (constant in unsuccessfulConstants) { - LorenzUtils.chat(" §e- §7$constant") + ChatUtils.chat(" §e- §7$constant") } } return } if (unsuccessfulConstants.isEmpty() && successfulConstants.isNotEmpty()) { - LorenzUtils.chat("Repo working fine! Commit hash: $latestRepoCommit", prefixColor = "§a") + ChatUtils.chat("Repo working fine! Commit hash: $latestRepoCommit", prefixColor = "§a") return } - LorenzUtils.chat("Repo has errors! Commit has: ${latestRepoCommit ?: "null"}", prefixColor = "§c") + ChatUtils.chat("Repo has errors! Commit has: ${latestRepoCommit ?: "null"}", prefixColor = "§c") +// if (successfulConstants.isNotEmpty()) ChatUtils.chat( if (successfulConstants.isNotEmpty()) LorenzUtils.chat( "Successful Constants §7(${successfulConstants.size}):", prefixColor = "§a" ) for (constant in successfulConstants) { - LorenzUtils.chat(" §a- §7$constant", false) + ChatUtils.chat(" §a- §7$constant", false) } - LorenzUtils.chat("Unsuccessful Constants §7(${unsuccessfulConstants.size}):") + ChatUtils.chat("Unsuccessful Constants §7(${unsuccessfulConstants.size}):") for (constant in unsuccessfulConstants) { - LorenzUtils.chat(" §e- §7$constant", false) + ChatUtils.chat(" §e- §7$constant", false) } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt index 7ec70c673..38a08f8d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt @@ -31,7 +31,7 @@ object RepoUtils { // create output directory if it doesn't exist if (!dir.exists()) dir.mkdirs() val fis: FileInputStream - //buffer for read and write data to file + // buffer for read and write data to file val buffer = ByteArray(1024) try { fis = FileInputStream(zipFilePath) @@ -42,7 +42,7 @@ object RepoUtils { var fileName = ze.name fileName = fileName.substring(fileName.split("/").toTypedArray()[0].length + 1) val newFile = File(destDir + File.separator + fileName) - //create directories for sub directories in zip + // create directories for sub directories in zip File(newFile.parent).mkdirs() if (!isInTree(dir, newFile)) { throw RuntimeException( @@ -56,11 +56,11 @@ object RepoUtils { } fos.close() } - //close this ZipEntry + // close this ZipEntry zis.closeEntry() ze = zis.nextEntry } - //close last ZipEntry + // close last ZipEntry zis.closeEntry() zis.close() fis.close() diff --git a/src/main/java/at/hannibal2/skyhanni/events/BlockClickEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/BlockClickEvent.kt index b256113a3..0ca9fb78c 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/BlockClickEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/BlockClickEvent.kt @@ -6,5 +6,6 @@ import at.hannibal2.skyhanni.utils.LorenzVec import net.minecraft.item.ItemStack class BlockClickEvent(val clickType: ClickType, val position: LorenzVec, val itemInHand: ItemStack?) : LorenzEvent() { + val getBlockState by lazy { position.getBlockStateAt() } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/CheckRenderEntityEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/CheckRenderEntityEvent.kt index bd9a816cb..13da59c43 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/CheckRenderEntityEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/CheckRenderEntityEvent.kt @@ -10,5 +10,5 @@ data class CheckRenderEntityEvent( val camera: ICamera, val camX: Double, val camY: Double, - val camZ: Double -) : LorenzEvent() \ No newline at end of file + val camZ: Double, +) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/CropClickEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/CropClickEvent.kt index 469dee006..1bc664cda 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/CropClickEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/CropClickEvent.kt @@ -9,5 +9,5 @@ class CropClickEvent( val crop: CropType, val blockState: IBlockState, val clickType: ClickType, - val itemInHand: ItemStack? -) : LorenzEvent() \ No newline at end of file + val itemInHand: ItemStack?, +) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/EntityEquipmentChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/EntityEquipmentChangeEvent.kt index eecc132ca..efef20840 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/EntityEquipmentChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/EntityEquipmentChangeEvent.kt @@ -6,8 +6,9 @@ import net.minecraft.item.ItemStack data class EntityEquipmentChangeEvent( val entity: Entity, val equipmentSlot: Int, - val newItemStack: ItemStack? + val newItemStack: ItemStack?, ) : LorenzEvent() { + val isHead get() = equipmentSlot == EQUIPMENT_SLOT_HEAD val isChest get() = equipmentSlot == EQUIPMENT_SLOT_CHEST val isLeggings get() = equipmentSlot == EQUIPMENT_SLOT_LEGGINGS @@ -15,6 +16,7 @@ data class EntityEquipmentChangeEvent( val isHand get() = equipmentSlot == EQUIPMENT_SLOT_HAND companion object { + const val EQUIPMENT_SLOT_HEAD = 4 const val EQUIPMENT_SLOT_CHEST = 3 const val EQUIPMENT_SLOT_LEGGINGS = 2 diff --git a/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt index b09062543..68c913c1f 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt @@ -7,5 +7,5 @@ class EntityMoveEvent( val entity: Entity, val oldLocation: LorenzVec, val newLocation: LorenzVec, - val distance: Double -) : LorenzEvent() \ No newline at end of file + val distance: Double, +) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt index 437130bdd..f6ffc4295 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt @@ -12,7 +12,7 @@ abstract class GuiContainerEvent(open val gui: GuiContainer, open val container: override val container: Container, val mouseX: Int, val mouseY: Int, - val partialTicks: Float + val partialTicks: Float, ) : GuiContainerEvent(gui, container) @Cancelable @@ -21,18 +21,19 @@ abstract class GuiContainerEvent(open val gui: GuiContainer, open val container: abstract class DrawSlotEvent(gui: GuiContainer, container: Container, open val slot: Slot) : GuiContainerEvent(gui, container) { + @Cancelable data class GuiContainerDrawSlotPre( override val gui: GuiContainer, override val container: Container, - override val slot: Slot + override val slot: Slot, ) : DrawSlotEvent(gui, container, slot) data class GuiContainerDrawSlotPost( override val gui: GuiContainer, override val container: Container, - override val slot: Slot + override val slot: Slot, ) : DrawSlotEvent(gui, container, slot) } @@ -42,7 +43,7 @@ abstract class GuiContainerEvent(open val gui: GuiContainer, open val container: override val container: Container, val mouseX: Int, val mouseY: Int, - val partialTicks: Float + val partialTicks: Float, ) : GuiContainerEvent(gui, container) @Cancelable @@ -52,6 +53,6 @@ abstract class GuiContainerEvent(open val gui: GuiContainer, open val container: val slot: Slot?, val slotId: Int, val clickedButton: Int, - val clickType: Int + val clickType: Int, ) : GuiContainerEvent(gui, container) -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt index f879dbc39..58dc557e8 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/GuiRenderItemEvent.kt @@ -9,15 +9,16 @@ abstract class GuiRenderItemEvent : LorenzEvent() { open val stack: ItemStack?, open val x: Int, open val y: Int, - open val text: String? + open val text: String?, ) : GuiRenderItemEvent() { + data class GuiRenderItemPost( override val fontRenderer: FontRenderer, override val stack: ItemStack?, override val x: Int, override val y: Int, - override val text: String? + override val text: String?, ) : RenderOverlayEvent(fontRenderer, stack, x, y, text) } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt index 72630756a..7b94efd55 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/InventoryCloseEvent.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.data.OtherInventoryData import net.minecraft.item.ItemStack class InventoryCloseEvent(val inventory: OtherInventoryData.Inventory, val reopenSameName: Boolean) : LorenzEvent() { + val inventoryId: Int by lazy { inventory.windowId } val inventoryName: String by lazy { inventory.title } val inventorySize: Int by lazy { inventory.slotCount } diff --git a/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt index 7ff2ca293..bc9e97ed8 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.data.OtherInventoryData import net.minecraft.item.ItemStack open class InventoryOpenEvent(private val inventory: OtherInventoryData.Inventory) : LorenzEvent() { + val inventoryId: Int by lazy { inventory.windowId } val inventoryName: String by lazy { inventory.title } val inventorySize: Int by lazy { inventory.slotCount } diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt index acce544db..c2c51cec6 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzChatEvent.kt @@ -6,5 +6,5 @@ class LorenzChatEvent( var message: String, var chatComponent: IChatComponent, var blockedReason: String = "", - var chatLineId: Int = 0 + var chatLineId: Int = 0, ) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt index 90d68ed35..c83ec95aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.mixins.hooks.getValue import at.hannibal2.skyhanni.mixins.hooks.setValue import at.hannibal2.skyhanni.mixins.transformers.AccessorEventBus import at.hannibal2.skyhanni.test.command.ErrorManager -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import net.minecraftforge.common.MinecraftForge import net.minecraftforge.fml.common.eventhandler.Event import net.minecraftforge.fml.common.eventhandler.IEventListener @@ -19,6 +19,7 @@ abstract class LorenzEvent : Event() { fun postAndCatch() = postAndCatchAndBlock {} companion object { + var eventHandlerDepth by object : ThreadLocal() { override fun initialValue(): Int { return 0 @@ -55,7 +56,7 @@ abstract class LorenzEvent : Event() { eventHandlerDepth-- if (errors > visibleErrors) { val hiddenErrors = errors - visibleErrors - LorenzUtils.error("$hiddenErrors more errors in $eventName are hidden!") + ChatUtils.error("$hiddenErrors more errors in $eventName are hidden!") } return if (isCancelable) isCanceled else false } diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt index 5bf8d7c2e..ba8a30e56 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzTickEvent.kt @@ -1,7 +1,8 @@ package at.hannibal2.skyhanni.events class LorenzTickEvent(private val tick: Int) : LorenzEvent() { + fun isMod(i: Int) = tick % i == 0 fun repeatSeconds(i: Int) = isMod(i * 20) -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt index 9e18fced9..52a6dc1d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt @@ -4,5 +4,6 @@ import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack class LorenzToolTipEvent(val slot: Slot, val itemStack: ItemStack, var toolTip: MutableList) : LorenzEvent() { + fun toolTipRemovedPrefix() = toolTip.map { it.removePrefix("§5§o") } } diff --git a/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt index 71c1cfa73..7d356707e 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt @@ -8,6 +8,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable * Note: This event is async and may not be executed on the main minecraft thread. */ abstract class PacketEvent : LorenzEvent() { + abstract val direction: Direction abstract val packet: Packet<*> @@ -15,6 +16,7 @@ abstract class PacketEvent : LorenzEvent() { * Note: This event is async and may not be executed on the main minecraft thread. */ data class ReceiveEvent(override val packet: Packet<*>) : PacketEvent() { + override val direction = Direction.INBOUND } @@ -22,10 +24,11 @@ abstract class PacketEvent : LorenzEvent() { * Note: This event is async and may not be executed on the main minecraft thread. */ data class SendEvent(override val packet: Packet<*>) : PacketEvent() { + override val direction = Direction.OUTBOUND } enum class Direction { INBOUND, OUTBOUND } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt index bd03261ea..123d5e881 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/PlaySoundEvent.kt @@ -7,5 +7,6 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable @Cancelable class PlaySoundEvent(val soundName: String, val location: LorenzVec, val pitch: Float, val volume: Float) : LorenzEvent() { + val distanceToPlayer by lazy { location.distanceToPlayer() } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt index 975990b86..68f42f43b 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt @@ -13,8 +13,9 @@ class ReceiveParticleEvent( val speed: Float, val offset: LorenzVec, val longDistance: Boolean, - val particleArgs: IntArray + val particleArgs: IntArray, ) : LorenzEvent() { + val distanceToPlayer by lazy { location.distanceToPlayer() } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderEntityOutlineEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderEntityOutlineEvent.kt index 6a197de6c..d061becf9 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderEntityOutlineEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderEntityOutlineEvent.kt @@ -111,8 +111,8 @@ class RenderEntityOutlineEvent(theType: Type?, potentialEntities: HashSet, ) : LorenzEvent() { + var stackTip = "" set(value) { renderObjects.add(RenderObject(value, 0, 0)) } } -class RenderObject(val text: String, var offsetX: Int = 0, var offsetY: Int = 0) \ No newline at end of file +class RenderObject(val text: String, var offsetX: Int = 0, var offsetY: Int = 0) diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderMobColoredEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderMobColoredEvent.kt index ef4a55563..cfcdfb37b 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderMobColoredEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderMobColoredEvent.kt @@ -2,5 +2,5 @@ package at.hannibal2.skyhanni.events import net.minecraft.entity.EntityLivingBase -//TODO remove -class RenderMobColoredEvent(val entity: EntityLivingBase, var color: Int) : LorenzEvent() \ No newline at end of file +// TODO remove +class RenderMobColoredEvent(val entity: EntityLivingBase, var color: Int) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt index 2f96e4482..7768e6586 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.events import net.minecraft.entity.EntityLivingBase import java.awt.Color -//TODO remove +// TODO remove class ResetEntityHurtEvent(val entity: EntityLivingBase, var shouldReset: Boolean) : LorenzEvent() -fun Color.withAlpha(alpha: Int): Int = (alpha.coerceIn(0, 255) shl 24) or (this.rgb and 0x00ffffff) \ No newline at end of file +fun Color.withAlpha(alpha: Int): Int = (alpha.coerceIn(0, 255) shl 24) or (this.rgb and 0x00ffffff) diff --git a/src/main/java/at/hannibal2/skyhanni/events/SackChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/SackChangeEvent.kt index aa6101a62..aa81287d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/SackChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/SackChangeEvent.kt @@ -5,5 +5,5 @@ import at.hannibal2.skyhanni.data.SackAPI class SackChangeEvent( val sackChanges: List, val otherItemsAdded: Boolean, - val otherItemsRemoved: Boolean + val otherItemsRemoved: Boolean, ) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt index 6d3d39299..0c0c4f627 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt @@ -5,5 +5,5 @@ import at.hannibal2.skyhanni.features.fishing.SeaCreature class SeaCreatureFishEvent( val seaCreature: SeaCreature, val chatEvent: LorenzChatEvent, - val doubleHook: Boolean -) : LorenzEvent() \ No newline at end of file + val doubleHook: Boolean, +) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt index b8ac2eb28..fae3399e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ServerBlockChangeEvent.kt @@ -7,19 +7,19 @@ import net.minecraft.block.state.IBlockState import net.minecraft.util.BlockPos class ServerBlockChangeEvent(private val blockPos: BlockPos, private val blockState: IBlockState) : LorenzEvent() { + val location by lazy { blockPos.toLorenzVec() } val old by lazy { location.getBlockAt().toString().getName() } val new by lazy { blockState.block.toString().getName() } companion object { + val pattern = "Block\\{minecraft:(?.*)}".toPattern() private fun String.getName() = pattern.matchMatcher(this) { group("name") } ?: this - } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt index 840253166..6a9c65b8a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt @@ -25,9 +25,11 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BazaarApi { + private var loadedNpcPriceData = false companion object { + val holder = BazaarDataHolder() var inBazaarInventory = false private var currentSearchedItem = "" diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt index f78b682d7..de37b8b9b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt @@ -18,6 +18,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BazaarBestSellMethod { + private var display = "" // Working with the last clicked item manually because diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt index 5df99f31e..b0e96ca1f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.bazaar import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -42,7 +43,7 @@ class BazaarCancelledBuyOrderClipboard { patternCancelledMessage.matchMatcher(event.message) { event.blockedReason = "bazaar cancelled buy order clipbaord" val coins = group("coins") - LorenzUtils.chat("Bazaar buy order cancelled. $latestAmount saved to clipboard. ($coins coins)") + ChatUtils.chat("Bazaar buy order cancelled. $latestAmount saved to clipboard. ($coins coins)") latestAmount?.let { OSUtils.copyToClipboard(it.replace(",", "")) } latestAmount = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt index 452003c1e..5a4f956a9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt @@ -3,8 +3,8 @@ package at.hannibal2.skyhanni.features.bazaar import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.APIUtil +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull @@ -16,6 +16,7 @@ import kotlin.concurrent.fixedRateTimer class BazaarDataHolder { companion object { + private val bazaarData = mutableMapOf() private var npcPrices = mapOf() @@ -42,7 +43,7 @@ class BazaarDataHolder { RiftAPI.motesPrice = motesPrice } catch (e: Throwable) { e.printStackTrace() - LorenzUtils.error("Error while trying to read bazaar item list from api: " + e.message) + ChatUtils.error("Error while trying to read bazaar item list from api: " + e.message) } return list } @@ -62,7 +63,7 @@ class BazaarDataHolder { private fun createNewData(internalName: NEUInternalName): BazaarData? { val stack = internalName.getItemStackOrNull() if (stack == null) { - LorenzUtils.debug("Bazaar data is null: '$internalName'") + ChatUtils.debug("Bazaar data is null: '$internalName'") return null } val displayName = stack.name!!.removeColor() diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt index 74922ebe4..0f03c9b0d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt @@ -14,6 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class BazaarOpenPriceWebsite { + private val config get() = SkyHanniMod.feature.bazaar private var lastClick = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOrderHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOrderHelper.kt index fa0dd8187..da828ef31 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOrderHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOrderHelper.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.bazaar import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -15,11 +16,13 @@ import net.minecraft.inventory.Slot import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BazaarOrderHelper { + private val bazaarItemNamePattern = "§.§l(?BUY|SELL) (?.*)".toPattern() private val filledPattern = "§7Filled: §[a6].*§7/.* §a§l100%!".toPattern() private val pricePattern = "§7Price per unit: §6(?.*) coins".toPattern() companion object { + fun isBazaarOrderInventory(inventoryName: String): Boolean = when (inventoryName) { "Your Bazaar Orders" -> true "Co-op Bazaar Orders" -> true @@ -56,7 +59,7 @@ class BazaarOrderHelper { private fun highlightItem(itemName: String, slot: Slot, buyOrSell: Pair) { val data = BazaarApi.getBazaarDataByName(itemName) if (data == null) { - LorenzUtils.debug("Bazaar data is null for bazaarItemName '$itemName'") + ChatUtils.debug("Bazaar data is null for bazaarItemName '$itemName'") return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt index 282791154..a86a05c60 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt @@ -18,6 +18,7 @@ import java.time.OffsetDateTime import java.time.ZoneOffset object BingoAPI { + private var ranks = mapOf() private var data: Map = emptyMap() 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 eb130b06b..7c0e74cae 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt @@ -2,19 +2,21 @@ package at.hannibal2.skyhanni.features.bingo import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CompactBingoChat { + private val config get() = SkyHanniMod.feature.event.bingo.compactChat private var inSkillLevelUp = false private var inSkyBlockLevelUp = false private var inCollectionLevelUp = false private var collectionLevelUpLastLine: String? = null - private var newArea = 0//0 = nothing, 1 = after first message, 2 = after second message + private var newArea = 0// 0 = nothing, 1 = after first message, 2 = after second message private val healthPattern = " {3}§r§7§8\\+§a.* §c❤ Health".toPattern() private val strengthPattern = " {3}§r§7§8\\+§a. §c❁ Strength".toPattern() @@ -93,7 +95,7 @@ class CompactBingoChat { if (message.contains("Trade") || message.contains("Recipe")) { val text = message.removeColor().replace(" ", "") if (text == "Trade" || text == "Recipe") { - collectionLevelUpLastLine?.let { LorenzUtils.chat(it, false) } + collectionLevelUpLastLine?.let { ChatUtils.chat(it, false) } } } else { collectionLevelUpLastLine = message diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt index f7366235c..ab5e2f3bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt @@ -25,7 +25,7 @@ object FirstMinionTier { private fun addMoreMinions( tierOneMinionsFiltered: List, help: Map, - minions: MutableMap + minions: MutableMap, ) { for (minionId in tierOneMinionsFiltered) { for (recipe in NEUItems.getRecipes(minionId)) { @@ -39,7 +39,7 @@ object FirstMinionTier { recipe: CraftingRecipe, help: Map, minions: MutableMap, - minionId: NEUInternalName + minionId: NEUInternalName, ) { if (recipe.getCachedIngredients().any { help.contains(it.internalItemId.asInternalName()) }) { val name = recipe.output.itemStack.name!!.removeColor() @@ -51,7 +51,7 @@ object FirstMinionTier { private fun addMinion( tierOneMinionsFiltered: List, minions: MutableMap, - tierOneMinionsDone: MutableList + tierOneMinionsDone: MutableList, ) { for (minionId in tierOneMinionsFiltered) { val prefix = minionId.asString().dropLast(1) @@ -63,7 +63,7 @@ object FirstMinionTier { private fun getTierOneMinionsFiltered( tierOneMinions: MutableList, - tierOneMinionsDone: MutableList + tierOneMinionsDone: MutableList, ) = tierOneMinions.filter { it !in tierOneMinionsDone } private fun helpMap(otherItems: Map) = 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 dd060aa9b..930ea6883 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -28,6 +28,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class MinionCraftHelper { + private val config get() = SkyHanniMod.feature.event.bingo // TODO USE SH-REPO @@ -296,5 +297,4 @@ class MinionCraftHelper { } data.add("tierOneMinionsDone", newList) } - } 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 94490b1d8..f7c166d37 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 @@ -9,10 +9,11 @@ import at.hannibal2.skyhanni.events.bingo.BingoCardUpdateEvent import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.features.bingo.card.goals.BingoGoal import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.BingoNextStepHelper +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.onToggle import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -34,6 +35,7 @@ class BingoCardDisplay { private var hasHiddenPersonalGoals = false companion object { + private const val MAX_PERSONAL_GOALS = 20 private const val MAX_COMMUNITY_GOALS = 5 @@ -50,11 +52,11 @@ class BingoCardDisplay { fun toggleCommand() { if (!LorenzUtils.isBingoProfile) { - LorenzUtils.userError("This command only works on a bingo profile!") + ChatUtils.userError("This command only works on a bingo profile!") return } if (!config.enabled) { - LorenzUtils.userError("Bingo Card is disabled in the config!") + ChatUtils.userError("Bingo Card is disabled in the config!") return } toggleMode() 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 9dc7ee907..be27e25a2 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 @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.features.bingo.card.goals.BingoGoal import at.hannibal2.skyhanni.features.bingo.card.goals.GoalType import at.hannibal2.skyhanni.features.bingo.card.goals.HiddenGoalData +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -22,6 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration class BingoCardReader { + private val config get() = SkyHanniMod.feature.event.bingo.bingoCard private val percentagePattern by RepoPattern.pattern("bingo.card.percentage", " {2}§8Top §.(?.*)%") @@ -97,7 +99,7 @@ class BingoCardReader { val oldFormat = BingoAPI.getCommunityPercentageColor(old) val newFormat = BingoAPI.getCommunityPercentageColor(new) val color = if (new > old) "§c" else "§a" - LorenzUtils.chat("$color${bingoGoal.displayName}: $oldFormat §b->" + " $newFormat") + ChatUtils.chat("$color${bingoGoal.displayName}: $oldFormat §b->" + " $newFormat") } private fun readCommuntyGoalPercentage(lore: List): Double? { 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 b219f7d44..6148848b6 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 @@ -16,6 +16,7 @@ import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BingoCardTips { + private val config get() = SkyHanniMod.feature.event.bingo.bingoCard @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/goals/BingoGoal.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/goals/BingoGoal.kt index f6758360b..120e66112 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/goals/BingoGoal.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/goals/BingoGoal.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.bingo.card.goals import com.google.gson.annotations.Expose class BingoGoal { + @Expose lateinit var type: GoalType 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 0cd5df65a..6987edb82 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 @@ -17,15 +17,17 @@ import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps.ObtainCrys import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps.PartialProgressItemsStep import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps.ProgressionStep import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps.SkillLevelStep +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BingoNextStepHelper { + private val config get() = SkyHanniMod.feature.event.bingo.bingoCard private var dirty = true @@ -41,6 +43,7 @@ class BingoNextStepHelper { 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() @@ -152,7 +155,7 @@ class BingoNextStepHelper { currentStep.amountHavingHidden -= 10 } } - //TODO add thys message + // TODO add thys message // if (event.message == "thys message") { // thys.done() // } @@ -202,7 +205,7 @@ class BingoNextStepHelper { done = true updateResult() if (!silent && config.stepHelper) { - LorenzUtils.chat("A bingo goal step is done! ($displayName)") + ChatUtils.chat("A bingo goal step is done! ($displayName)") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt index e6bb7075b..d3f33a27d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt @@ -5,5 +5,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil class CollectionStep(collectionName: String, amountNeeded: Int) : ProgressionStep(NumberUtil.format(amountNeeded) + " $collectionName Collection", amountNeeded.toLong()) { + val internalName by lazy { NEUInternalName.fromItemName(if (collectionName == "Mushroom") "Red Mushroom" else collectionName) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/ItemsStep.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/ItemsStep.kt index 548318a20..cf856f001 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/ItemsStep.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/ItemsStep.kt @@ -5,6 +5,7 @@ open class ItemsStep(displayName: String, val itemName: String, amountNeeded: Lo class PartialProgressItemsStep(displayName: String, itemName: String, amountNeeded: Long, variants: Map) : ItemsStep(displayName, itemName, amountNeeded, variants) { + var amountHavingHidden: Int = 0 override val amountNeeded: Long get() = super.amountNeeded - amountHavingHidden diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/NextStep.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/NextStep.kt index d0a73926a..b9e9b574e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/NextStep.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/NextStep.kt @@ -3,5 +3,5 @@ package at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps abstract class NextStep( val displayName: String, var done: Boolean = false, - val requirements: MutableList = mutableListOf() + val requirements: MutableList = mutableListOf(), ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/SkillLevelStep.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/SkillLevelStep.kt index e93aa24b0..c87a8683c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/SkillLevelStep.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/SkillLevelStep.kt @@ -5,6 +5,6 @@ import at.hannibal2.skyhanni.data.SkillExperience class SkillLevelStep( val skillName: String, private val skillLevelNeeded: Int, - skillExpNeeded: Long = SkillExperience.getExpForLevel(skillLevelNeeded) + skillExpNeeded: Long = SkillExperience.getExpForLevel(skillLevelNeeded), ) : ProgressionStep("$skillName $skillLevelNeeded", skillExpNeeded) 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 72b28d013..54dc6bed0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ArachneChatMessageHider { + private val config get() = SkyHanniMod.feature.chat private var hideArachneDeadMessage = false 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 2c0437e01..fdeeb25e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -10,6 +10,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern class ChatFilter { + private val config get() = SkyHanniMod.feature.chat.filterType /// @@ -97,13 +98,13 @@ class ChatFilter { "§7Putting item in escrow...", "§7Putting coins in escrow...", - //Auction House + // Auction House "§7Setting up the auction...", "§7Processing purchase...", "§7Processing bid...", "§7Claiming BIN auction...", - //Bazaar + // Bazaar "§6[Bazaar] §r§7Submitting sell offer...", "§6[Bazaar] §r§7Submitting buy order...", "§6[Bazaar] §r§7Executing instant sell...", @@ -112,18 +113,18 @@ class ChatFilter { "§6[Bazaar] §r§7Claiming order...", "§6[Bazaar] §r§7Putting goods in escrow...", - //Bank + // Bank "§8Depositing coins...", "§8Withdrawing coins..." ) // Slayer private val slayerPatterns = listOf( - //start + // start " {2}§r§5§lSLAYER QUEST STARTED!".toPattern(), " {3}§5§l» §7Slay §c(.*) Combat XP §7worth of (.*)§7.".toPattern(), - //end + // end " {2}§r§a§lSLAYER QUEST COMPLETE!".toPattern(), " {3}§r§e(.*)Slayer LVL 9 §r§5- §r§a§lLVL MAXED OUT!".toPattern(), " {3}§r§5§l» §r§7Talk to Maddox to claim your (.*) Slayer XP!".toPattern() @@ -137,7 +138,7 @@ class ChatFilter { // Slayer Drop private val slayerDropPatterns = listOf( - //Zombie + // Zombie "§b§lRARE DROP! §r§7\\(§r§f§r§9Revenant Viscera§r§7\\) (.*)".toPattern(), "§b§lRARE DROP! §r§7\\(§r§f§r§7(.*)x §r§f§r§9Foul Flesh§r§7\\) (.*)".toPattern(), "§b§lRARE DROP! §r§7\\(§r§f§r§9Foul Flesh§r§7\\) (.*)".toPattern(), @@ -147,7 +148,7 @@ class ChatFilter { "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§9Undead Catalyst§r§7\\) (.*)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§2◆ Pestilence Rune I§r§7\\) §r§b(.*)".toPattern(), - //Tarantula + // Tarantula "§6§lRARE DROP! §r§9Arachne's Keeper Fragment (.+)".toPattern(), "§6§lRARE DROP! §r§5Travel Scroll to Spider's Den Top of Nest (.+)".toPattern(), "§9§lVERY RARE DROP! {2}§r§7\\(§r§f§r§a◆ Bite Rune I§r§7\\) (.+)".toPattern(), @@ -155,7 +156,7 @@ class ChatFilter { "§b§lRARE DROP! §r§7\\(§r§f§r§aToxic Arrow Poison§r§7\\) (.+)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§9Bane of Arthropods VI§r§7\\) (.+)".toPattern(), - //Enderman + // Enderman "§b§lRARE DROP! §r§7\\(§r§f§r§7(.*)x §r§f§r§aTwilight Arrow Poison§r§7\\) (.*)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§fMana Steal I§r§7\\) (.*)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§5Sinful Dice§r§7\\) (.*)".toPattern(), @@ -167,7 +168,7 @@ class ChatFilter { "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§5◆ End Rune I§r§7\\) (.*)".toPattern(), "§5§lVERY RARE DROP! {2}§r§7\\(§r§f§r§6Hazmat Enderman§r§7\\) .*".toPattern(), - //Blaze + // Blaze "§9§lVERY RARE DROP! {2}§r§7\\(§r§f§r§fWisp's Ice-Flavored Water I Splash Potion§r§7\\) (.*)".toPattern(), "§b§lRARE DROP! §r§7\\(§r§f§r§5Bundle of Magma Arrows§r§7\\) (.*)".toPattern(), "§9§lVERY RARE DROP! {2}§r§7\\(§r§f§r§7\\d+x §r§f§r§9(Glowstone|Blaze Rod|Magma Cream|Nether Wart) Distillate§r§7\\) (.*)".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt index b9a9a6e0b..e40854c9d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.data.ChatManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils @@ -15,6 +16,7 @@ import net.minecraft.util.IChatComponent import org.lwjgl.input.Mouse class ChatFilterGui(private val history: List) : GuiScreen() { + private var scroll = -1.0 private val w = 500 private var wasMouseButtonDown = false @@ -61,11 +63,11 @@ class ChatFilterGui(private val history: List) { if (!isEnabled()) return if (args.size < 2 || args[0].length != 2) { // args[0] is the language code - LorenzUtils.userError("Usage: /shcopytranslation ") + ChatUtils.userError("Usage: /shcopytranslation ") return } val language = args[0] @@ -163,7 +164,7 @@ class Translator { coroutineScope.launch { val translation = getTranslationFromEnglish(message, language) - LorenzUtils.chat("Copied translation to clipboard: $translation") + ChatUtils.chat("Copied translation to clipboard: $translation") OSUtils.copyToClipboard(translation) } } 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 f70c10ea0..11e51e686 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt @@ -47,6 +47,7 @@ class WatchdogHider { } companion object { + private const val watchdogStartLine = "§f" private const val watchdogAnnouncementLine = "§4[WATCHDOG ANNOUNCEMENT]" private const val watchdogEndLine = "§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 4a80f8084..024835aeb 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 @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.features.chat.playerchat +import at.hannibal2.skyhanni.data.jsonobjects.repo.PlayerChatFilterJson import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.MultiFilter -import at.hannibal2.skyhanni.data.jsonobjects.repo.PlayerChatFilterJson import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PlayerChatFilter { 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 c95763adf..a9c302021 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 @@ -69,7 +69,7 @@ class PlayerChatModifier { // TODO remove workaround if (!DungeonMilestonesDisplay.isMilestoneMessage(input)) { - //all players same color in chat + // all players same color in chat string = string.replace("§r§7: ", "§r§f: ") } } @@ -93,6 +93,4 @@ class PlayerChatModifier { event.move(3, "chat.playerRankHider", "chat.playerMessage.playerRankHider") event.move(3, "chat.chatFilter", "chat.playerMessage.chatFilter") } - - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt index 902caadf0..61e69a67b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt @@ -15,6 +15,7 @@ import net.minecraft.client.Minecraft */ object ChromaShader : Shader("chroma", "chroma") { + val config get() = SkyHanniMod.feature.chroma val INSTANCE: ChromaShader get() = this diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt index 49526c6f8..a5b0cd386 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt @@ -9,12 +9,12 @@ import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addButton import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -168,7 +168,8 @@ object BestiaryData { for ((lineIndex, line) in stack.getLore().withIndex()) { val loreLine = line.removeColor() if (loreLine.startsWith("Kills: ")) { - actualRealTotalKill = "([0-9,.]+)".toRegex().find(loreLine)?.groupValues?.get(1)?.formatNumber() ?: 0 + actualRealTotalKill = "([0-9,.]+)".toRegex().find(loreLine)?.groupValues?.get(1)?.formatNumber() + ?: 0 } if (!loreLine.startsWith(" ")) continue val previousLine = stack.getLore()[lineIndex - 1] @@ -437,7 +438,7 @@ object BestiaryData { val name: String, val familiesFound: Long, val totalFamilies: Long, - val familiesCompleted: Long + val familiesCompleted: Long, ) data class BestiaryMob( @@ -447,7 +448,7 @@ object BestiaryData { var totalKills: Long, var killNeededForNextLevel: Long, var currentKillToNextLevel: Long, - var actualRealTotalKill: Long + var actualRealTotalKill: Long, ) { fun killNeededToMax(): Long { @@ -482,5 +483,4 @@ object BestiaryData { } private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt index 8f419f803..5562a4bf4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt @@ -8,9 +8,10 @@ enum class BossType( val fullName: String, val bossTypeToggle: Type, val shortName: String = fullName, - val showDeathTime: Boolean = false + val showDeathTime: Boolean = false, ) { - //Nether Mini Bosses + + // Nether Mini Bosses NETHER_BLADESOUL("§8Bladesoul", Type.NETHER_MINI_BOSSES), NETHER_MAGMA_BOSS("§4Magma Boss", Type.NETHER_MINI_BOSSES), NETHER_ASHFANG("§cAshfang", Type.NETHER_MINI_BOSSES), @@ -20,7 +21,7 @@ enum class BossType( NETHER_VANQUISHER("§5Vanquisher", Type.VANQUISHER), END_ENDSTONE_PROTECTOR("§cEndstone Protector", Type.ENDERSTONE_PROTECTOR), - END_ENDER_DRAGON("Ender Dragon", Type.ENDER_DRAGON),//TODO fix totally + END_ENDER_DRAGON("Ender Dragon", Type.ENDER_DRAGON),// TODO fix totally SLAYER_ZOMBIE_1("§aRevenant Horror 1", Type.REVENANT_HORROR, "§aRev 1", showDeathTime = true), SLAYER_ZOMBIE_2("§eRevenant Horror 2", Type.REVENANT_HORROR, "§eRev 2", showDeathTime = true), @@ -66,7 +67,6 @@ enum class BossType( HUB_HEADLESS_HORSEMAN("§6Headless Horseman", Type.HEADLESS_HORSEMAN), - DUNGEON_F1_BONZO_FIRST("§cFunny Bonzo", Type.DUNGEON_FLOOR_1), DUNGEON_F1_BONZO_SECOND("§cSad Bonzo", Type.DUNGEON_FLOOR_1), @@ -106,7 +106,7 @@ enum class BossType( LEECH_SUPREME("§cLeech Supreme", Type.THE_RIFT_BOSSES), BACTE("§aBacte", Type.THE_RIFT_BOSSES), - WINTER_REINDRAKE("Reindrake", Type.REINDRAKE),//TODO fix totally + WINTER_REINDRAKE("Reindrake", Type.REINDRAKE),// TODO fix totally GARDEN_PEST_BEETLE("§cBeetle", Type.GARDEN_PESTS), GARDEN_PEST_CRICKET("§cCricket", Type.GARDEN_PESTS), @@ -119,11 +119,10 @@ enum class BossType( GARDEN_PEST_SLUG("§cSlug", Type.GARDEN_PESTS), GARDEN_PEST_EARTHWORM("§cEarthworm", Type.GARDEN_PESTS), - //TODO arachne - - //TODO corelone - //TODO bal + // TODO arachne + // TODO corelone + // TODO bal /** * TODO dungeon mini bosses @@ -136,5 +135,5 @@ enum class BossType( * */ - //TODO diana mythological creatures + // TODO diana mythological creatures } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageCounter.kt index 1595b728a..9bf83e04e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageCounter.kt @@ -8,5 +8,4 @@ class DamageCounter { var currentHealing = 0L var oldDamages = LinkedList() var firstTick = 0L - -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt index 3e6b2e6da..b87002c0e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt @@ -18,6 +18,9 @@ import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.features.slayer.blaze.HellionShield import at.hannibal2.skyhanni.features.slayer.blaze.setHellionShield import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy +import at.hannibal2.skyhanni.utils.CollectionUtils.put import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen @@ -28,10 +31,7 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy -import at.hannibal2.skyhanni.utils.LorenzUtils.put import at.hannibal2.skyhanni.utils.LorenzUtils.round -import at.hannibal2.skyhanni.utils.LorenzUtils.ticks import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -41,6 +41,7 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils.format +import at.hannibal2.skyhanni.utils.TimeUtils.ticks import at.hannibal2.skyhanni.utils.getLorenzVec import com.google.gson.JsonArray import net.minecraft.client.Minecraft @@ -71,6 +72,7 @@ class DamageIndicatorManager { private val enderSlayerHitsNumberPattern = ".* §[5fd]§l(?\\d+) Hits?".toPattern() companion object { + private var data = mapOf() private val damagePattern = "[✧✯]?(\\d+[⚔+✧❤♞☄✷ﬗ✯]*)".toPattern() @@ -129,7 +131,7 @@ class DamageIndicatorManager { GlStateManager.disableDepth() GlStateManager.disableCull() - //TODO config to define between 100ms and 5 sec + // TODO config to define between 100ms and 5 sec val filter = data.filter { val waitForRemoval = if (it.value.dead && !noDeathDisplay(it.value.bossType)) 4_000 else 100 (System.currentTimeMillis() > it.value.timeLastTick + waitForRemoval) || (it.value.dead && noDeathDisplay(it.value.bossType)) @@ -169,7 +171,7 @@ class DamageIndicatorManager { for (data in data.values) { - //TODO test end stone protector in hole? - maybe change eye pos + // TODO test end stone protector in hole? - maybe change eye pos // data.ignoreBlocks = // data.bossType == BossType.END_ENDSTONE_PROTECTOR && Minecraft.getMinecraft().thePlayer.isSneaking @@ -266,7 +268,6 @@ class DamageIndicatorManager { diff += 9f } } - } GlStateManager.enableDepth() GlStateManager.enableCull() @@ -285,7 +286,7 @@ class DamageIndicatorManager { BossType.SLAYER_BLAZE_QUAZII_3, BossType.SLAYER_BLAZE_QUAZII_4, - //TODO f3/m3 4 guardians, f2/m2 4 boss room fighters + // TODO f3/m3 4 guardians, f2/m2 4 boss room fighters -> true else -> false @@ -399,7 +400,7 @@ class DamageIndicatorManager { val thorn = checkThorn(health, maxHealth) if (thorn == null) { val floor = DungeonAPI.dungeonFloor - LorenzUtils.error("problems with thorn detection! ($floor, $health/$maxHealth)") + ChatUtils.error("problems with thorn detection! ($floor, $health/$maxHealth)") } return thorn } @@ -437,7 +438,7 @@ class DamageIndicatorManager { BossType.SLAYER_ZOMBIE_5 -> { if ((entity as EntityZombie).hasNameTagWith(3, "§fBoom!")) { - //TODO fix + // TODO fix // val ticksAlive = entity.ticksExisted % (20 * 5) // val remainingTicks = (5 * 20).toLong() - ticksAlive // val format = formatDelay(remainingTicks * 50) @@ -545,9 +546,9 @@ class DamageIndicatorManager { } } + " §f" - //hide while in the middle + // hide while in the middle // val position = entity.getLorenzVec() - //TODO other logic or something + // TODO other logic or something // entityData.healthLineHidden = position.x == -368.0 && position.z == -804.0 var calcHealth = -1 @@ -562,7 +563,7 @@ class DamageIndicatorManager { calcHealth = 0 break } else { - LorenzUtils.error("unknown magma boss health sidebar format!") + ChatUtils.error("unknown magma boss health sidebar format!") break } @@ -641,7 +642,7 @@ class DamageIndicatorManager { entityData.namePrefix = "" } - //Hit phase + // Hit phase var hitPhaseText: String? = null val armorStandHits = entity.getNameTagWith(3, " Hit") if (armorStandHits != null) { @@ -659,7 +660,7 @@ class DamageIndicatorManager { hitPhaseText = NumberUtil.percentageColor(hits.toLong(), maxHits.toLong()).getChatColor() + "$hits Hits" } - //Laser phase + // Laser phase if (config.enderSlayer.laserPhaseTimer && entity.ridingEntity != null) { val totalTimeAlive = 8.2.seconds @@ -776,7 +777,7 @@ class DamageIndicatorManager { } } } else { - LorenzUtils.error("Invalid/impossible thorn floor!") + ChatUtils.error("Invalid/impossible thorn floor!") return null } val color = NumberUtil.percentageColor(health.toLong(), maxHealth.toLong()) @@ -791,7 +792,7 @@ class DamageIndicatorManager { damageCounter.currentDamage += damage } if (healing > 0) { - //Hide auto heal every 10 ticks (with rounding errors) + // Hide auto heal every 10 ticks (with rounding errors) if ((healing == 15_000L || healing == 15_001L) && entityData.bossType == BossType.SLAYER_ZOMBIE_5) return val damageCounter = entityData.damageCounter @@ -905,7 +906,6 @@ class DamageIndicatorManager { result } - } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/EntityData.kt index af07242a6..1ab969946 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/EntityData.kt @@ -25,6 +25,7 @@ class EntityData( var firstDeath: Boolean = false, // TODO this defines if hp is very low, replace dead with this later var deathLocation: LorenzVec? = null, ) { + val timeToKill by lazy { "§e" + foundTime.passedSince().format(TimeUnit.SECOND, showMilliSeconds = true) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt index 3bc048aa0..6c284d596 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt @@ -45,20 +45,20 @@ import java.util.UUID class MobFinder { - //F1 + // F1 private var floor1bonzo1 = false private var floor1bonzo1SpawnTime = 0L private var floor1bonzo2 = false private var floor1bonzo2SpawnTime = 0L - //F2 + // F2 private var floor2summons1 = false private var floor2summons1SpawnTime = 0L private var floor2summonsDiedOnce = mutableListOf() private var floor2secondPhase = false private var floor2secondPhaseSpawnTime = 0L - //F3 + // F3 private var floor3GuardianShield = false private var floor3GuardianShieldSpawnTime = 0L private var guardians = mutableListOf() @@ -69,13 +69,13 @@ class MobFinder { private var floor3ProfessorGuardian = false private var floor3ProfessorGuardianEntity: EntityGuardian? = null - //F5 + // F5 private var floor5lividEntity: EntityOtherPlayerMP? = null private var floor5lividEntitySpawnTime = 0L private val correctLividPattern = "§c\\[BOSS] (.*) Livid§r§f: Impossible! How did you figure out which one I was\\?!".toPattern() - //F6 + // F6 private var floor6Giants = false private var floor6GiantsSpawnTime = 0L private var floor6GiantsSeparateDelay = mutableMapOf>() @@ -166,7 +166,7 @@ class MobFinder { } if (floor2secondPhase && entity is EntityOtherPlayerMP) { - //TODO only show scarf after (all/at least x) summons are dead? + // TODO only show scarf after (all/at least x) summons are dead? if (entity.name == "Scarf ") { return EntityResult( floor2secondPhaseSpawnTime, @@ -343,7 +343,7 @@ class MobFinder { } } - //TODO testing and use sidebar data + // TODO testing and use sidebar data private fun tryAddEntityDragon(entity: EntityLivingBase) = when { IslandType.THE_END.isInIsland() -> EntityResult(bossType = BossType.END_ENDER_DRAGON) IslandType.WINTER.isInIsland() -> EntityResult(bossType = BossType.WINTER_REINDRAKE) @@ -482,22 +482,21 @@ class MobFinder { var pos = 0 - val type: BossType if (loc.x > middle.x && loc.z > middle.z) { - //first + // first pos = 2 type = BossType.DUNGEON_F6_GIANT_3 } else if (loc.x > middle.x && loc.z < middle.z) { - //second + // second pos = 3 type = BossType.DUNGEON_F6_GIANT_4 } else if (loc.x < middle.x && loc.z < middle.z) { - //third + // third pos = 0 type = BossType.DUNGEON_F6_GIANT_1 } else if (loc.x < middle.x && loc.z > middle.z) { - //fourth + // fourth pos = 1 type = BossType.DUNGEON_F6_GIANT_2 } else { @@ -505,7 +504,6 @@ class MobFinder { type = BossType.DUNGEON_F6_GIANT_1 } - val extraDelay = 900L * pos val pair = Pair(extraDelay, type) floor6GiantsSeparateDelay[uuid] = pair @@ -516,7 +514,7 @@ class MobFinder { fun handleChat(message: String) { if (!LorenzUtils.inDungeons) return when (message) { - //F1 + // F1 "§c[BOSS] Bonzo§r§f: Gratz for making it this far, but I'm basically unbeatable." -> { floor1bonzo1 = true floor1bonzo1SpawnTime = System.currentTimeMillis() + 11_250 @@ -535,7 +533,7 @@ class MobFinder { floor1bonzo2 = false } - //F2 + // F2 "§c[BOSS] Scarf§r§f: ARISE, MY CREATIONS!" -> { floor2summons1 = true floor2summons1SpawnTime = System.currentTimeMillis() + 3_500 @@ -554,7 +552,7 @@ class MobFinder { floor2secondPhase = false } - //F3 + // F3 "§c[BOSS] The Professor§r§f: I was burdened with terrible news recently..." -> { floor3GuardianShield = true floor3GuardianShieldSpawnTime = System.currentTimeMillis() + 15_400 @@ -582,13 +580,13 @@ class MobFinder { floor3ProfessorGuardian = false } - //F5 + // F5 "§c[BOSS] Livid§r§f: This Orb you see, is Thorn, or what is left of him." -> { floor5lividEntity = DungeonLividFinder.lividEntity floor5lividEntitySpawnTime = System.currentTimeMillis() + 13_000 } - //F6 + // F6 "§c[BOSS] Sadan§r§f: ENOUGH!" -> { floor6Giants = true floor6GiantsSpawnTime = System.currentTimeMillis() + 7_400 @@ -614,7 +612,6 @@ class MobFinder { if (LorenzUtils.inDungeons && floor3ProfessorGuardian && entity is EntityGuardian && floor3ProfessorGuardianEntity == null) { floor3ProfessorGuardianEntity = entity floor3ProfessorGuardianPrepare = false - } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt index 87f83208a..adb0edd38 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt @@ -11,12 +11,12 @@ import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent import at.hannibal2.skyhanni.events.SackChangeEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.afterChange import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -28,6 +28,7 @@ import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object EnderNodeTracker { + private val config get() = SkyHanniMod.feature.combat.enderNodeTracker private var miteGelInInventory = 0 @@ -191,7 +192,8 @@ object EnderNodeTracker { EnderNode.END_LEGGINGS, EnderNode.END_BOOTS, EnderNode.ENDER_NECKLACE, - EnderNode.ENDER_GAUNTLET -> true + EnderNode.ENDER_GAUNTLET, + -> true else -> false } 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 be138463f..5c1e0976e 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,6 +24,9 @@ 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.utils.ChatUtils.chat +import at.hannibal2.skyhanni.utils.ChatUtils.clickableChat +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.CombatUtils._isKilling import at.hannibal2.skyhanni.utils.CombatUtils.calculateETA import at.hannibal2.skyhanni.utils.CombatUtils.calculateXP @@ -38,9 +41,6 @@ import at.hannibal2.skyhanni.utils.CombatUtils.xpGainHourLast import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.chat -import at.hannibal2.skyhanni.utils.LorenzUtils.clickableChat import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -131,7 +131,10 @@ object GhostCounter { } val avgMagicFind = when (Option.TOTALDROPS.get()) { 0.0 -> "0" - else -> "${((((storage?.totalMF!! / Option.TOTALDROPS.get()) + Math.ulp(1.0)) * 100) / 100).roundToPrecision(2)}" + else -> { + val mf = (((storage?.totalMF!! / Option.TOTALDROPS.get()) + Math.ulp(1.0)) * 100) / 100 + mf.roundToPrecision(2).toString() + } } val xpHourFormatting = textFormatting.xpHourFormatting @@ -424,7 +427,7 @@ object GhostCounter { Option.KILLCOMBO.set(0.0) update() } - //replace with BestiaryLevelUpEvent ? + // replace with BestiaryLevelUpEvent ? bestiaryPattern.matchMatcher(event.message) { val currentLevel = group("nextLevel").toInt() when (val nextLevel = if (currentLevel >= 25) 26 else currentLevel + 1) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt index 9c5de8c43..61e03cf97 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.combat.ghostcounter import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.ProfileStorageData -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision @@ -65,7 +65,7 @@ object GhostUtil { val c = ProfileStorageData.profileSpecific?.ghostCounter ?: return if (isUsingCTGhostCounter()) { if (c.ctDataImported) { - LorenzUtils.userError("You already imported GhostCounterV3 data!") + ChatUtils.userError("You already imported GhostCounterV3 data!") return } val json = ConfigManager.gson.fromJson( @@ -83,9 +83,9 @@ object GhostUtil { ?: json["TotalMF"].asDouble GhostData.Option.TOTALDROPS.add(json["TotalDrops"].asDouble) c.ctDataImported = true - LorenzUtils.chat("§aImported data successfully!") + ChatUtils.chat("§aImported data successfully!") } else - LorenzUtils.error("GhostCounterV3 ChatTriggers module not found!") + ChatUtils.error("GhostCounterV3 ChatTriggers module not found!") } fun String.formatText(option: GhostData.Option) = formatText(option.getInt(), option.getInt(true)) 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 af7c4804d..e3d76a41e 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 @@ -25,6 +25,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class AreaMiniBossFeatures { + private val config get() = SkyHanniMod.feature.combat.mobs private var lastSpawnTime = SimpleTimeMark.farPast() private var miniBossType: AreaMiniBossType? = null @@ -92,8 +93,9 @@ class AreaMiniBossFeatures { val health: Int, val color: LorenzColor, val colorOpacity: Int, - vararg val spawnLocations: LorenzVec + vararg val spawnLocations: LorenzVec, ) { + GOLDEN_GHOUL( EntityZombie::class.java, 45_000, LorenzColor.YELLOW, 127, LorenzVec(-99.7, 39.0, -86.4), 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 657e13d73..aa861a29b 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 @@ -9,6 +9,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AshfangMinisNametagHider { + private val config get() = SkyHanniMod.feature.combat.mobs @SubscribeEvent(priority = EventPriority.HIGH) @@ -25,4 +26,4 @@ class AshfangMinisNametagHider { event.isCanceled = true } } -} \ No newline at end of file +} 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 b55fc7c03..d7ecc8f52 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 @@ -18,6 +18,7 @@ import net.minecraft.entity.monster.EntitySpider import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class MobHighlight { + private val config get() = SkyHanniMod.feature.combat.mobs @SubscribeEvent 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 81426c90f..08c8ddf31 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 @@ -22,12 +22,15 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class SpawnTimers { + private val config get() = SkyHanniMod.feature.combat.mobs private val arachneAltarLocation = LorenzVec(-283f, 51f, -179f) private var arachneSpawnTime = SimpleTimeMark.farPast() - private val arachneFragmentMessage = "^☄ [a-z0-9_]{2,22} placed an arachne's calling! something is awakening! \\(4/4\\)\$".toPattern() - private val arachneCrystalMessage = "^☄ [a-z0-9_]{2,22} placed an arachne crystal! something is awakening!$".toPattern() + private val arachneFragmentMessage = + "^☄ [a-z0-9_]{2,22} placed an arachne's calling! something is awakening! \\(4/4\\)\$".toPattern() + private val arachneCrystalMessage = + "^☄ [a-z0-9_]{2,22} placed an arachne crystal! something is awakening!$".toPattern() private var saveNextTickParticles = false private var particleCounter = 0 private var tickTime: Long = 0 @@ -76,7 +79,7 @@ class SpawnTimers { if (particleCounter == 0 && tickTime == 0L) tickTime = System.currentTimeMillis() if (System.currentTimeMillis() > tickTime + 60) { - arachneSpawnTime = if (particleCounter <= 20) { + arachneSpawnTime = if (particleCounter <= 20) { SimpleTimeMark.now() + 21.seconds } else { SimpleTimeMark.now() + 37.seconds @@ -95,5 +98,6 @@ class SpawnTimers { } } - fun isEnabled() = IslandType.SPIDER_DEN.isInIsland() && LorenzUtils.skyBlockArea == "Arachne's Sanctuary" && config.showArachneSpawnTimer + fun isEnabled() = + IslandType.SPIDER_DEN.isInIsland() && LorenzUtils.skyBlockArea == "Arachne's Sanctuary" && config.showArachneSpawnTimer } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt index 5f3217cdf..6b352ca8c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyCommands.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object PartyCommands { + private val config get() = SkyHanniMod.feature.commands fun kickOffline() { @@ -61,7 +62,8 @@ object PartyCommands { return } if (!event.message.startsWith("/party kick ", ignoreCase = true) - && !event.message.startsWith("/p kick ", ignoreCase = true)) { + && !event.message.startsWith("/p kick ", ignoreCase = true) + ) { return } val args = event.message.split(" ") 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 a41547c68..34797780b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt @@ -12,11 +12,11 @@ class SendCoordinatedCommand { val message = event.message if (message == "/sendcoords") { event.isCanceled = true - LorenzUtils.sendMessageToServer(getCoordinates()) + LorenzUtils.sendCommandToServer(getCoordinates()) } else if (message.startsWith("/sendcoords ")) { event.isCanceled = true val description = message.split(" ").drop(1).joinToString(" ") - LorenzUtils.sendMessageToServer("${getCoordinates()} $description") + LorenzUtils.sendCommandToServer("${getCoordinates()} $description") } } @@ -27,5 +27,4 @@ class SendCoordinatedCommand { val z = location.z.toInt() return "x: $x, y: $y, z: $z" } - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt index c486f6f50..26873a2ad 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.utils.NEUItems import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object ViewRecipeCommand { + private val config get() = SkyHanniMod.feature.commands @SubscribeEvent @@ -16,7 +17,7 @@ object ViewRecipeCommand { if (message == message.uppercase()) return if (message.startsWith("/viewrecipe ", ignoreCase = true)) { event.isCanceled = true - LorenzUtils.sendMessageToServer(message.uppercase()) + LorenzUtils.sendCommandToServer(message.uppercase()) } } 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 4cb06b568..183238762 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt @@ -14,7 +14,7 @@ class WarpIsCommand { if (event.message.lowercase() == "/warp is") { event.isCanceled = true - LorenzUtils.sendMessageToServer("/is") + LorenzUtils.sendCommandToServer("/is") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt index c1aab3a1c..ff3b4fac3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.commands import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.MessageSendToServerEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment @@ -60,7 +61,7 @@ object WikiManager { fun onKeybind(event: GuiScreenEvent.KeyboardInputEvent.Post) { if (!LorenzUtils.inSkyBlock) return val gui = event.gui as? GuiContainer ?: return - if (NEUItems.neuHasFocus()) return //because good heavens if this worked on neuitems... + if (NEUItems.neuHasFocus()) return // because good heavens if this worked on neuitems... val stack = gui.slotUnderMouse?.stack ?: return if (!config.wikiKeybind.isKeyHeld()) return @@ -78,7 +79,7 @@ object WikiManager { fun otherWikiCommands(args: Array, useFandom: Boolean, wikithis: Boolean = false) { if (wikithis && !LorenzUtils.inSkyBlock) { - LorenzUtils.chat("§cYou must be in SkyBlock to do this!") + ChatUtils.chat("§cYou must be in SkyBlock to do this!") return } @@ -87,7 +88,7 @@ object WikiManager { if (wikithis) { val itemInHand = InventoryUtils.getItemInHand() ?: run { - LorenzUtils.chat("§cYou must be holding an item to use this command!") + ChatUtils.chat("§cYou must be holding an item to use this command!") return } wikiTheItem(itemInHand, false, useFandom = useFandom) @@ -107,7 +108,7 @@ object WikiManager { val wiki = if (useFandom) "SkyBlock Fandom Wiki" else "Official SkyBlock Wiki" val urlPrefix = if (useFandom) FANDOM_URL_PREFIX else OFFICIAL_URL_PREFIX if (search == "") { - LorenzUtils.clickableLinkChat( + ChatUtils.clickableLinkChat( "§7Click §e§lHERE §7to visit the §6$wiki§7!", urlPrefix, "§7The $wiki!" ) return @@ -116,7 +117,7 @@ object WikiManager { val urlSearchPrefix = if (useFandom) "$urlPrefix$FANDOM_SEARCH_PREFIX" else "$urlPrefix$OFFICIAL_SEARCH_PREFIX" val searchUrl = "$urlSearchPrefix${URLEncoder.encode(search, "UTF-8")}&scope=internal" - LorenzUtils.clickableLinkChat( + ChatUtils.clickableLinkChat( "§7Click §e§lHERE §7to find §a$displaySearch §7on the §6$wiki§7!", searchUrl, "§7View §a$displaySearch §7on the §6$wiki§7!", diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt index f3738c6b4..e4b0071ad 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GetFromSacksTabComplete { + private val config get() = SkyHanniMod.feature.commands.tabComplete private var sackList = emptyList() private val commands = arrayOf("gfs", "getfromsacks") @@ -36,7 +37,7 @@ object GetFromSacksTabComplete { if (realName == rawName) return if (realName !in sackList) return event.isCanceled = true - LorenzUtils.sendMessageToServer(message.replace(rawName, realName)) + LorenzUtils.sendCommandToServer(message.replace(rawName, realName)) } fun isEnabled() = LorenzUtils.inSkyBlock && config.gfsSack diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt index 9df128920..3384db554 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt @@ -4,14 +4,15 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.FriendAPI import at.hannibal2.skyhanni.data.PartyAPI +import at.hannibal2.skyhanni.data.jsonobjects.repo.VipVisitsJson import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.EntityUtils.isNPC -import at.hannibal2.skyhanni.data.jsonobjects.repo.VipVisitsJson import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object PlayerTabComplete { + private val config get() = SkyHanniMod.feature.commands.tabComplete private var vipVisits = listOf() diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt index c5487fdb8..53a0a8f84 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt @@ -1,12 +1,13 @@ package at.hannibal2.skyhanni.features.commands.tabcomplete import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.jsonobjects.repo.WarpsJson import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.data.jsonobjects.repo.WarpsJson import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object WarpTabComplete { + private val config get() = SkyHanniMod.feature.commands.tabComplete private var warps = listOf() 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 da18e8d28..482799d27 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt @@ -4,9 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod 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.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.SimpleTimeMark 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 9e77ab6e4..7f617fc64 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt @@ -5,10 +5,10 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy -import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation @@ -20,6 +20,7 @@ import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds class CosmeticFollowingLine { + private val config get() = SkyHanniMod.feature.misc.cosmetic.followingLine private var locations = mapOf() @@ -49,7 +50,7 @@ class CosmeticFollowingLine { private fun renderFar( event: LorenzRenderWorldEvent, firstPerson: Boolean, - color: Color + color: Color, ) { val last7 = locations.keys.toList().takeLast(7) val last2 = locations.keys.toList().takeLast(2) diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt index c1d8415e0..bb38d09b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt @@ -10,12 +10,11 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.equalsOneOf import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.equalsOneOf -import at.hannibal2.skyhanni.utils.LorenzUtils.getOrNull import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -25,6 +24,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DungeonAPI { + private val floorPattern = " §7⏣ §cThe Catacombs §7\\((?.*)\\)".toPattern() private val uniqueClassBonus = "^Your ([A-Za-z]+) stats are doubled because you are the only player using this class!$".toRegex() @@ -37,6 +37,7 @@ class DungeonAPI { private val totalKillsPattern = "§7Total Kills: §e(?.*)".toPattern() companion object { + var dungeonFloor: String? = null var started = false var inBossRoom = false @@ -170,7 +171,7 @@ class DungeonAPI { private fun readOneMaxCollection( bossCollections: MutableMap, inventoryItems: Map, - inventoryName: String + inventoryName: String, ) { inventoryItems[48]?.let { item -> if (item.name == "§aGo Back") { @@ -248,6 +249,7 @@ class DungeonAPI { F7("Necron"); companion object { + fun byBossName(bossName: String) = DungeonFloor.entries.firstOrNull { it.bossName == bossName } } } 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 51ee98029..48765a095 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt @@ -16,7 +16,7 @@ class DungeonBossMessages { ) private val messageList = listOf( - //M7 – Dragons + // M7 – Dragons "§cThe Crystal withers your soul as you hold it in your hands!", "§cIt doesn't seem like that is supposed to go there." ) 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 a133cb6be..acdc50f95 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt @@ -224,7 +224,7 @@ class DungeonChatFilter { } } - private fun String.isFiltered(key: MessageTypes) : Boolean { + private fun String.isFiltered(key: MessageTypes): Boolean { return config.dungeonFilteredMessageTypes.contains(key) && this.isPresent(key) } 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 4ee2c8761..7e436eb36 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern @@ -78,7 +79,7 @@ class DungeonCleanEnd { if (event.health <= 0.5) { val dungeonFloor = DungeonAPI.dungeonFloor - LorenzUtils.chat("§eFloor $dungeonFloor done!", false) + ChatUtils.chat("§eFloor $dungeonFloor done!", false) bossDone = true } } @@ -126,5 +127,4 @@ class DungeonCleanEnd { event.move(3, "dungeon.cleanEndToggle", "dungeon.cleanEnd.enabled") event.move(3, "dungeon.cleanEndF3IgnoreGuardians", "dungeon.cleanEnd.F3IgnoreGuardians") } - } 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 794736954..8510b6b6c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.DungeonStartEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils.matches @@ -55,7 +56,7 @@ class DungeonDeathCounter { if (isDeathMessage(event.message)) { deaths++ - LorenzUtils.chat("§c§l$deaths. DEATH!", false) + ChatUtils.chat("§c§l$deaths. DEATH!", false) update() } } 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 0413be873..4521aa2b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt @@ -21,6 +21,7 @@ import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DungeonFinderFeatures { + private val config get() = SkyHanniMod.feature.dungeon.partyFinder private val pricePattern = "([0-9]{2,3}K|[0-9]{1,3}M|[0-9]+\\.[0-9]M|[0-9] ?mil)".toRegex(RegexOption.IGNORE_CASE) @@ -170,7 +171,6 @@ class DungeonFinderFeatures { fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "dungeon.partyFinderColoredClassLevel", "dungeon.partyFinder.coloredClassLevel") } - } fun getColor(level: Int): String { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt index 0c5b4fc52..291b7775b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt @@ -29,6 +29,7 @@ import net.minecraft.util.AxisAlignedBB import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object DungeonLividFinder { + private val config get() = SkyHanniMod.feature.dungeon.lividFinder private val blockLocation = LorenzVec(6, 109, 43) diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt index fc5462901..3547a4827 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt @@ -12,6 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer class DungeonMilestonesDisplay { + private val config get() = SkyHanniMod.feature.dungeon companion object { 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 46e2e0514..eda282161 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonRankTabListColor.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class 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/DungeonTeammateOutlines.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt index 445b9676f..103bf35df 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonTeammateOutlines.kt @@ -12,6 +12,7 @@ import net.minecraft.scoreboard.Team import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DungeonTeammateOutlines { + private val config get() = SkyHanniMod.feature.dungeon @SubscribeEvent @@ -35,5 +36,4 @@ class DungeonTeammateOutlines { Minecraft.getMinecraft().fontRendererObj.getColorCode(colorFormat[1]) else null } - } 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 9cc992922..4447db0b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt @@ -11,6 +11,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TerracottaPhase { + private val config get() = SkyHanniMod.feature.dungeon.terracottaPhase private var inTerracottaPhase = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt index 78fbbe836..2442027e2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt @@ -27,6 +27,7 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object UniqueGiftingOpportunitiesFeatures { + private val playerList: MutableSet? get() = ProfileStorageData.playerSpecific?.winter?.playersThatHaveBeenGifted @@ -62,7 +63,6 @@ object UniqueGiftingOpportunitiesFeatures { val matchedPlayer = EntityUtils.getEntitiesNearby(entity.getLorenzVec(), 2.0) .singleOrNull { !it.isNPC() } ?: return addGiftedPlayer(matchedPlayer.name) - } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/Year300RaffleEvent.kt b/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/Year300RaffleEvent.kt index 71d8040f3..0123e94d1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/Year300RaffleEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/Year300RaffleEvent.kt @@ -21,6 +21,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds object Year300RaffleEvent { + private val config get() = SkyHanniMod.feature.event.century val displayItem by lazy { NEUItems.getItemStackOrNull("EPOCH_CAKE_ORANGE") ?: ItemStack(Items.clock) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowAPI.kt index db6de093f..8fabffb8d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowAPI.kt @@ -5,5 +5,4 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark object BurrowAPI { var lastBurrowRelatedChatMessage = SimpleTimeMark.farPast() - } 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 1b9e12195..43ae77b5a 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 @@ -6,10 +6,11 @@ import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraft.client.Minecraft @@ -50,8 +51,8 @@ class BurrowWarpHelper { if (lastWarpTime.passedSince() < 1.seconds) { lastWarp?.let { it.unlocked = false - LorenzUtils.chat("Detected not having access to warp point §b${it.displayName}§e!") - LorenzUtils.chat("Use §c/shresetburrowwarps §eonce you have activated this travel scroll.") + ChatUtils.chat("Detected not having access to warp point §b${it.displayName}§e!") + ChatUtils.chat("Use §c/shresetburrowwarps §eonce you have activated this travel scroll.") lastWarp = null currentWarp = null } @@ -89,6 +90,7 @@ class BurrowWarpHelper { } companion object { + private val config get() = SkyHanniMod.feature.event.diana var currentWarp: WarpPoint? = null @@ -116,7 +118,7 @@ class BurrowWarpHelper { fun resetDisabledWarps() { WarpPoint.entries.forEach { it.unlocked = true } - LorenzUtils.chat("Reset disabled burrow warps.") + ChatUtils.chat("Reset disabled burrow warps.") } } @@ -127,6 +129,7 @@ class BurrowWarpHelper { val ignored: () -> Boolean = { false }, var unlocked: Boolean = true, ) { + HUB("Hub", LorenzVec(-3, 70, -70), 2), CASTLE("Castle", LorenzVec(-250, 130, 45), 10), CRYPT("Crypt", LorenzVec(-190, 74, -88), 15, { config.ignoredWarps.crypt }), diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt index 1ab8c0154..a41ee2689 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt @@ -6,8 +6,9 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.ItemAddEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -23,6 +24,7 @@ import com.google.gson.annotations.Expose import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object DianaProfitTracker { + private val config get() = SkyHanniMod.feature.event.diana.dianaProfitTracker private var allowedDrops = listOf() @@ -41,6 +43,7 @@ object DianaProfitTracker { { it.diana.dianaProfitTracker }) { drawDisplay(it) } class Data : ItemTrackerData() { + override fun resetItems() { burrowsDug = 0 } @@ -94,7 +97,7 @@ object DianaProfitTracker { val internalName = event.internalName if (!isAllowedItem(internalName)) { - LorenzUtils.debug("Ignored non-diana item pickup: '$internalName'") + ChatUtils.debug("Ignored non-diana item pickup: '$internalName'") return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt index 468dadc18..5d53ce823 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt @@ -16,13 +16,14 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.features.event.diana.DianaAPI.isDianaSpade import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine @@ -38,6 +39,7 @@ import org.lwjgl.input.Keyboard import kotlin.time.Duration.Companion.seconds object GriffinBurrowHelper { + private val config get() = SkyHanniMod.feature.event.diana var targetLocation: LorenzVec? = null @@ -280,7 +282,6 @@ object GriffinBurrowHelper { } } } - } } @@ -303,28 +304,28 @@ object GriffinBurrowHelper { fun setTestBurrow(strings: Array) { if (!IslandType.HUB.isInIsland()) { - LorenzUtils.userError("You can only create test burrows on the hub island!") + ChatUtils.userError("You can only create test burrows on the hub island!") return } if (!isEnabled()) { if (!config.alwaysDiana) { - LorenzUtils.clickableChat("§cEnable Always Diana in the config!", "sh always diana") + ChatUtils.clickableChat("§cEnable Always Diana in the config!", "sh always diana") } else { - LorenzUtils.userError("Have an Ancestral Spade in the inventory!") + ChatUtils.userError("Have an Ancestral Spade in the inventory!") } return } if (strings.size != 1) { - LorenzUtils.userError("/shtestburrow ") + ChatUtils.userError("/shtestburrow ") return } val type: BurrowType = when (strings[0].lowercase()) { "reset" -> { resetAllData() - LorenzUtils.chat("Manually reset all burrow waypoints.") + ChatUtils.chat("Manually reset all burrow waypoints.") return } @@ -332,7 +333,7 @@ object GriffinBurrowHelper { "2", "mob" -> BurrowType.MOB "3", "treasure" -> BurrowType.TREASURE else -> { - LorenzUtils.userError("Unknown burrow type! Try 1-3 instead.") + ChatUtils.userError("Unknown burrow type! Try 1-3 instead.") return } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt index c49f6c551..9c83dfeda 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt @@ -23,6 +23,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds class GriffinBurrowParticleFinder { + private val config get() = SkyHanniMod.feature.event.diana private val recentlyDugParticleBurrows = TimeLimitedSet(1.minutes) @@ -180,7 +181,6 @@ class GriffinBurrowParticleFinder { burrows.remove(location) } } - } } 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 d49e3199a..587522c00 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 @@ -2,12 +2,14 @@ package at.hannibal2.skyhanni.features.event.diana import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class GriffinPetWarning { + private var lastWarnTime = SimpleTimeMark.farPast() @SubscribeEvent @@ -20,7 +22,7 @@ class GriffinPetWarning { if (!DianaAPI.hasGriffinPet() && lastWarnTime.passedSince() > 30.seconds) { lastWarnTime = SimpleTimeMark.now() LorenzUtils.sendTitle("§cGriffin Pet!", 3.seconds) - LorenzUtils.chat("Reminder to use a Griffin pet for Mythological Ritual!") + ChatUtils.chat("Reminder to use a Griffin pet for Mythological Ritual!") } } } 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 44f95cfcd..534dc4c91 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 @@ -10,6 +10,7 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HighlightInquisitors { + private val config get() = SkyHanniMod.feature.event.diana @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index d7a161957..9276823fe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -8,11 +8,12 @@ import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils @@ -28,6 +29,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds object InquisitorWaypointShare { + private val config get() = SkyHanniMod.feature.event.diana.inquisitorSharing // TODO USE SH-REPO @@ -50,14 +52,14 @@ object InquisitorWaypointShare { val fromPlayer: String, val displayName: String, val location: LorenzVec, - val spawnTime: SimpleTimeMark + val spawnTime: SimpleTimeMark, ) private var test = false fun test() { test = !test - LorenzUtils.chat("Inquisitor Test " + if (test) "Enabled" else "Disabled") + ChatUtils.chat("Inquisitor Test " + if (test) "Enabled" else "Disabled") } @SubscribeEvent @@ -149,7 +151,7 @@ object InquisitorWaypointShare { val keyName = KeyboardManager.getKeyName(config.keyBindShare) val message = "§l§bYou found a Inquisitor! Press §l§chere §l§bor §c$keyName to share the location!" - LorenzUtils.clickableChat(message, "shshareinquis") + ChatUtils.clickableChat(message, "shshareinquis") } } @@ -193,18 +195,18 @@ object InquisitorWaypointShare { lastShareTime = System.currentTimeMillis() if (inquisitor == -1) { - LorenzUtils.error("No Inquisitor Found!") + ChatUtils.error("No Inquisitor Found!") return } val inquisitor = EntityUtils.getEntityByID(inquisitor) if (inquisitor == null) { - LorenzUtils.chat("§cInquisitor out of range!") + ChatUtils.chat("§cInquisitor out of range!") return } if (inquisitor.isDead) { - LorenzUtils.chat("§cInquisitor is dead") + ChatUtils.chat("§cInquisitor is dead") return } val location = inquisitor.getLorenzVec() @@ -234,7 +236,7 @@ object InquisitorWaypointShare { val name = rawName.cleanPlayerName() val displayName = rawName.cleanPlayerName(displayName = true) if (!waypoints.containsKey(name)) { - LorenzUtils.chat("$displayName §l§efound an inquisitor at §l§c$x $y $z!") + ChatUtils.chat("$displayName §l§efound an inquisitor at §l§c$x $y $z!") if (name != LorenzUtils.getPlayerName()) { LorenzUtils.sendTitle("§dINQUISITOR §efrom §b$displayName", 5.seconds) SoundUtils.playBeepSound() @@ -259,7 +261,7 @@ object InquisitorWaypointShare { fun maybeRemove(inquis: SharedInquisitor) { if (inquisitorsNearby.isEmpty()) { waypoints = waypoints.editCopy { remove(inquis.fromPlayer) } - LorenzUtils.chat("Inquisitor from ${inquis.displayName} not found, deleting.") + ChatUtils.chat("Inquisitor from ${inquis.displayName} not found, deleting.") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt index 1d2884bc1..dbcc1574e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt @@ -4,10 +4,11 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.sumAllValues +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.sumAllValues import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matches @@ -34,10 +35,12 @@ object MythologicalCreatureTracker { private val config get() = SkyHanniMod.feature.event.diana.mythologicalMobtracker - private val tracker = SkyHanniTracker("Mythological Creature Tracker", { Data() }, { it.diana.mythologicalMobTracker }) - { drawDisplay(it) } + private val tracker = + SkyHanniTracker("Mythological Creature Tracker", { Data() }, { it.diana.mythologicalMobTracker }) + { drawDisplay(it) } class Data : TrackerData() { + override fun reset() { count.clear() } @@ -86,7 +89,7 @@ object MythologicalCreatureTracker { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - LorenzUtils.onToggle(config.showPercentage) { + ConditionalUtils.onToggle(config.showPercentage) { tracker.update() } } 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 2fa31408d..125bf718f 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 @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.events.BurrowGuessEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.util.EnumParticleTypes @@ -109,7 +109,7 @@ class SoopyGuessBurrow { distance2 = (Math.E / slope) - firstParticlePoint?.distance(pos)!! if (distance2!! > 1000) { - LorenzUtils.debug("Soopy distance2 is $distance2") + ChatUtils.debug("Soopy distance2 is $distance2") distance2 = null guessPoint = null @@ -227,7 +227,7 @@ class SoopyGuessBurrow { i++ } - //Why does this happen? + // Why does this happen? if (pr1.isEmpty()) return val p1 = pr1.last() 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 fb2852cea..4bc5225b9 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 @@ -10,9 +10,10 @@ import net.minecraft.entity.passive.EntityVillager import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HighlightJerries { + private val config get() = SkyHanniMod.feature.event.jerry - //RED RED WHITE LIGHT_PURPLE are fallbacks in case Hypixel admins do a little trolling + // RED RED WHITE LIGHT_PURPLE are fallbacks in case Hypixel admins do a little trolling private val listOfLorenzColors = listOf( LorenzColor.RED, LorenzColor.RED, @@ -37,4 +38,4 @@ class HighlightJerries { RenderLivingEntityHelper.setEntityColor(entity, color) { config.highlightJerries } } } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasure.kt b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasure.kt index de1b9df1a..219a22285 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasure.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasure.kt @@ -8,6 +8,7 @@ enum class FrozenTreasure( val defaultAmount: Int, val iceMultiplier: Int = 0, ) { + WHITE_GIFT("WHITE_GIFT", "§fWhite Gift", 1), GREEN_GIFT("GREEN_GIFT", "§aGreen Gift", 1), RED_GIFT("RED_GIFT", "§9§cRed Gift", 1), diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt index f628c8a4b..7b3f236f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt @@ -9,9 +9,9 @@ import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.ConfigUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -25,6 +25,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer object FrozenTreasureTracker { + private val config get() = SkyHanniMod.feature.event.winter.frozenTreasureTracker private var estimatedIce = 0L private var lastEstimatedIce = 0L diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/EventWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/EventWaypoint.kt index da537d4c0..af2c17be0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/EventWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/EventWaypoint.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.utils.LorenzVec data class EventWaypoint( val name: String, val position: LorenzVec, - var isFound: Boolean = false + var isFound: Boolean = false, ) fun loadEventWaypoints(waypoints: Map>): Map> { 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 39ff40765..a6fa577e4 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 @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.event.lobby.waypoints.EventWaypoint import at.hannibal2.skyhanni.features.event.lobby.waypoints.loadEventWaypoints import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceSqToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils @@ -20,6 +21,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent // todo: create abstract class for this and BasketWaypoints class PresentWaypoints { + private val config get() = SkyHanniMod.feature.event.lobbyWaypoints.christmasPresent private var presentLocations = mapOf>() private var presentEntranceLocations = mapOf>() @@ -67,7 +69,7 @@ class PresentWaypoints { private fun handleAllPresentsFound() { // If all presents are found, disable the feature - LorenzUtils.chat("Congratulations! As all presents are found, we are disabling the Christmas Present Waypoints feature.") + ChatUtils.chat("Congratulations! As all presents are found, we are disabling the Christmas Present Waypoints feature.") config.allWaypoints = false config.allEntranceWaypoints = false } @@ -90,7 +92,7 @@ class PresentWaypoints { } private fun LorenzRenderWorldEvent.drawWaypoints( - waypoints: Set, shouldDraw: Boolean, color: LorenzColor, prefix: String + waypoints: Set, shouldDraw: Boolean, color: LorenzColor, prefix: String, ) { if (!shouldDraw) return waypoints.forEach { waypoint -> diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt index e2904f99e..3907986d9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt @@ -5,8 +5,9 @@ import at.hannibal2.skyhanni.utils.LorenzVec enum class BasketEntrances( val basketEntranceName: String, val waypoint: LorenzVec, - vararg val basket: Basket + vararg val basket: Basket, ) { + BASKET_ENTER_23("#23, #24 (behind the lava)", LorenzVec(-138, 74, -4), Basket.BASKET_23, Basket.BASKET_24), BASKET_ENTER_24("#24 (within this tunnel)", LorenzVec(-80, 72, -4), Basket.BASKET_24), BASKET_ENTER_25_1("#25 (1st digit, SNEAK + RCLICK)", LorenzVec(143, 65, -30), Basket.BASKET_25), 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 d9d90ca4a..2d96a88b9 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 @@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BasketWaypoints { + private val config get() = SkyHanniMod.feature.event.lobbyWaypoints.halloweenBasket private var closest: Basket? = null private var isHalloween: Boolean = false 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 f0334549e..d8ff05378 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,8 @@ import at.hannibal2.skyhanni.utils.TabListData import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TheGreatSpook { -// §r§cPrimal Fears§r§7: §r§6§lREADY!! + + // §r§cPrimal Fears§r§7: §r§6§lREADY!! private val config get() = SkyHanniMod.feature.event.spook private var displayTimer = "" private var displayFearStat = "" @@ -40,6 +41,7 @@ class TheGreatSpook { private fun checkTabList(matchString: String): String { return (TabListData.getTabList().find { it.contains(matchString) } ?: "").trim() } + @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (isTimerEnabled()) config.positionTimer.renderString(displayTimer, posLabel = "Primal Fear Timer") 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 91c892ca2..2839797f6 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 @@ -19,6 +19,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds class JyrreTimer { + private val config get() = SkyHanniMod.feature.event.winter.jyrreTimer private val drankBottlePattern by RepoPattern.pattern( "event.winter.drank.jyrre", 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 0198c96b3..4bc6c02b5 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 @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.ScoreboardChangeEvent import at.hannibal2.skyhanni.features.fame.ReminderUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matches @@ -16,6 +17,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class NewYearCakeReminder { + private val config get() = SkyHanniMod.feature.event.winter private val sidebarDetectionPattern by RepoPattern.pattern( "event.winter.newyearcake.reminder.sidebar", @@ -72,7 +74,7 @@ class NewYearCakeReminder { if (lastReminderSend.passedSince() < 30.seconds) return lastReminderSend = SimpleTimeMark.now() - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "Reminding you to grab the free New Year Cake. Click here to open the baker menu!", "openbaker" ) 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 6d010fae7..a383d8683 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt @@ -7,6 +7,7 @@ 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.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -17,6 +18,7 @@ import kotlin.time.Duration.Companion.days import kotlin.time.Duration.Companion.seconds class AccountUpgradeReminder { + private var inInventory = false private var duration: Duration? = null private var lastReminderSend = SimpleTimeMark.farPast() @@ -30,7 +32,6 @@ class AccountUpgradeReminder { } } - @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!LorenzUtils.inSkyBlock) return @@ -53,7 +54,7 @@ class AccountUpgradeReminder { if (lastReminderSend.passedSince() < 30.seconds) return lastReminderSend = SimpleTimeMark.now() - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "The §a$upgrade §eupgrade has completed! §c(Click to disable these reminders)", "shstopaccountupgradereminder" ) @@ -107,6 +108,7 @@ class AccountUpgradeReminder { } 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() 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 5bd8be726..bef023755 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt @@ -9,12 +9,13 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -33,6 +34,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CityProjectFeatures { + private var display = emptyList>() private var inInventory = false private var lastReminderSend = 0L @@ -48,10 +50,11 @@ class CityProjectFeatures { ) companion object { + private val config get() = SkyHanniMod.feature.event.cityProject fun disable() { config.dailyReminder = false - LorenzUtils.chat("Disabled city project reminder messages!") + ChatUtils.chat("Disabled city project reminder messages!") } } @@ -76,7 +79,7 @@ class CityProjectFeatures { if (lastReminderSend + 30_000 > System.currentTimeMillis()) return lastReminderSend = System.currentTimeMillis() - LorenzUtils.clickableChat( + ChatUtils.clickableChat( "Daily City Project Reminder! (Click here to disable this reminder)", "shstopcityprojectreminder" ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/ReminderUtils.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/ReminderUtils.kt index e68edf39e..1fdb7ad16 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/ReminderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/ReminderUtils.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.LorenzUtils object ReminderUtils { + // TODO: add arachne fight, add slayer boss spawned fun isBusy(): Boolean = LorenzUtils.inDungeons || LorenzUtils.inKuudraFight || FarmingContestAPI.inContest || RiftAPI.inRift() 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 24506a22b..d4b741472 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt @@ -4,15 +4,16 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.onToggle import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.entity.Entity import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ChumBucketHider { + private val config get() = SkyHanniMod.feature.fishing.chumBucketHider private val titleEntity = mutableListOf() private val hiddenEntities = mutableListOf() @@ -73,7 +74,7 @@ class ChumBucketHider { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - onToggle(config.enabled, config.hideBucket, config.hideOwn) { reset() } + ConditionalUtils.onToggle(config.enabled, config.hideBucket, config.hideOwn) { reset() } } private fun reset() { diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt index abcf3a234..173f5a0d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt @@ -28,6 +28,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds object FishingAPI { + val lavaBlocks = listOf(Blocks.lava, Blocks.flowing_lava) private val waterBlocks = listOf(Blocks.water, Blocks.flowing_water) @@ -121,5 +122,4 @@ object FishingAPI { } return 1 } - } 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 1177ad7e2..348ec0342 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.fishing.FishingAPI.isBait import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -19,6 +20,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class FishingBaitWarnings { + private val config get() = SkyHanniMod.feature.fishing.fishingBaitWarnings private var bobber: EntityFishHook? = null private var lastBait: String? = null @@ -76,13 +78,13 @@ class FishingBaitWarnings { private fun showBaitChangeWarning(before: String, after: String) { SoundUtils.playClickSound() LorenzUtils.sendTitle("§eBait changed!", 2.seconds) - LorenzUtils.chat("Fishing Bait changed: $before -> $after") + ChatUtils.chat("Fishing Bait changed: $before -> $after") } private fun showNoBaitWarning() { SoundUtils.playErrorSound() LorenzUtils.sendTitle("§cNo bait is used!", 2.seconds) - LorenzUtils.chat("You do not use any fishing baits!") + ChatUtils.chat("You do not use any fishing baits!") } private fun isEnabled() = LorenzUtils.inSkyBlock && FishingAPI.isFishing() && !LorenzUtils.inKuudraFight diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt index 38775705d..bbd029100 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt @@ -16,6 +16,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds object FishingDetection { + var isFishing = false private var holdingRod = false private var lastRodCastLocation: LorenzVec? = null 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 be076222f..73fe5e23a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt @@ -13,6 +13,7 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class FishingHookDisplay { + private val config get() = SkyHanniMod.feature.fishing.fishingHookDisplay private var armorStand: EntityArmorStand? = null private val potentionArmorStands = mutableListOf() 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 2b633f0a4..4257d7790 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt @@ -22,6 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class FishingTimer { + private val config get() = SkyHanniMod.feature.fishing.barnTimer private val barnLocation = LorenzVec(108, 89, -252) @@ -76,7 +77,8 @@ class FishingTimer { } } - private fun countMobs() = EntityUtils.getEntities().map { entity -> FishingAPI.seaCreatureCount(entity) }.sum() + private fun countMobs() = + EntityUtils.getEntities().map { entity -> FishingAPI.seaCreatureCount(entity) }.sum() private fun isRightLocation(): Boolean { inHollows = false 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 0d9bbb9c9..325411045 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt @@ -9,13 +9,13 @@ import at.hannibal2.skyhanni.events.SeaCreatureFishEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth -import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.LorenzUtils.ignoreDerpy import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils @@ -31,6 +31,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class SeaCreatureFeatures { + private val config get() = SkyHanniMod.feature.fishing.rareCatches private var rareSeaCreatures = listOf() private var lastRareCatch = SimpleTimeMark.farPast() @@ -58,7 +59,8 @@ class SeaCreatureFeatures { if (config.alertOtherCatches && lastRareCatch.passedSince() > 1.seconds) { val creature = SeaCreatureManager.allFishingMobs[creatureType.nametag] - LorenzUtils.sendTitle("${creature?.rarity?.chatColorCode ?: "§6"}RARE SEA CREATURE!", 1.5.seconds, 3.6, 7f) + val text = "${creature?.rarity?.chatColorCode ?: "§6"}RARE SEA CREATURE!" + LorenzUtils.sendTitle(text, 1.5.seconds, 3.6, 7f) if (config.playSound) SoundUtils.playBeepSound() } } @@ -104,8 +106,9 @@ class SeaCreatureFeatures { enum class RareSeaCreatureType( val clazz: Class, val nametag: String, - vararg val health: Int + vararg val health: Int, ) { + WATER_HYDRA(EntityZombie::class.java, "Water Hydra", 500_000), SEA_EMPEROR(EntityGuardian::class.java, "Sea Emperor", 750_000, 800_000), SEA_EMPEROR_RIDER(EntitySkeleton::class.java, "Sea Emperor", 750_000, 800_000), 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 5843bb97c..bfff1d7be 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt @@ -62,6 +62,7 @@ class SeaCreatureManager { } companion object { + private val seaCreatureMap = mutableMapOf() var allFishingMobs = mapOf() var allVariants = mapOf>() 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 1b1689e1f..72997fc6d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt @@ -7,6 +7,7 @@ import net.minecraft.util.ChatComponentText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SeaCreatureMessageShortener { + private val config get() = SkyHanniMod.feature.fishing @SubscribeEvent 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 f84a72d53..8f201648b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt @@ -5,12 +5,14 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.SeaCreatureFishEvent +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SharkFishCounter { + private var counter = mutableListOf(0, 0, 0, 0) private var display = "" private var hasWaterRodInHand = false @@ -56,7 +58,7 @@ class SharkFishCounter { val g = counter[3] // Great White val total = count.addSeparators() val funnyComment = funnyComment(count) - LorenzUtils.chat("You caught $total §f(§a$n §9$b §5$t §6$g§f) §esharks during this fishing contest. $funnyComment") + ChatUtils.chat("You caught $total §f(§a$n §9$b §5$t §6$g§f) §esharks during this fishing contest. $funnyComment") counter = mutableListOf(0, 0, 0, 0) 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 97945eb21..e2d1b297e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt @@ -19,6 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds class ShowFishingItemName { + private val config get() = SkyHanniMod.feature.fishing.fishedItemName private var hasRodInHand = false private var cache = TimeLimitedCache>(750.milliseconds) @@ -81,5 +82,4 @@ class ShowFishingItemName { } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled - } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt index 5a92ae51a..f8e5f8a2f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt @@ -7,9 +7,10 @@ import at.hannibal2.skyhanni.events.ItemAddEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.features.fishing.FishingAPI +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addButton import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName @@ -31,6 +32,7 @@ import kotlin.time.Duration.Companion.seconds typealias CategoryName = String object FishingProfitTracker { + val config get() = SkyHanniMod.feature.fishing.fishingProfitTracker private val coinsChatPattern = ".* CATCH! §r§bYou found §r§6(?.*) Coins§r§b\\.".toPattern() @@ -42,6 +44,7 @@ object FishingProfitTracker { { it.fishing.fishingProfitTracker }) { drawDisplay(it) } class Data : ItemTrackerData() { + override fun resetItems() { totalCatchAmount = 0 } @@ -190,7 +193,7 @@ object FishingProfitTracker { if (FishingAPI.lastActiveFishingTime.passedSince() > 10.minutes) return if (!isAllowedItem(internalName)) { - LorenzUtils.debug("Ignored non-fishing item pickup: $internalName'") + ChatUtils.debug("Ignored non-fishing item pickup: $internalName'") return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt index 8bfcadde7..34c94d198 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt @@ -9,13 +9,14 @@ import at.hannibal2.skyhanni.events.SeaCreatureFishEvent import at.hannibal2.skyhanni.features.fishing.FishingAPI import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.sumAllValues +import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addButton -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.sumAllValues import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.allLettersFirstUppercase @@ -33,11 +34,15 @@ object SeaCreatureTracker { private val tracker = SkyHanniTracker("Sea Creature Tracker", { Data() }, { it.fishing.seaCreatureTracker }) { drawDisplay(it) } - private val trophyArmorNames by RepoPattern.pattern("fishing.trophyfishing.armor", "(BRONZE|SILVER|GOLD|DIAMOND)_HUNTER_(HELMET|CHESTPLATE|LEGGINGS|BOOTS)") + private val trophyArmorNames by RepoPattern.pattern( + "fishing.trophyfishing.armor", + "(BRONZE|SILVER|GOLD|DIAMOND)_HUNTER_(HELMET|CHESTPLATE|LEGGINGS|BOOTS)" + ) private var lastArmorCheck = SimpleTimeMark.farPast() private var isTrophyFishing = false class Data : TrackerData() { + override fun reset() { amount.clear() } @@ -143,7 +148,7 @@ object SeaCreatureTracker { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - LorenzUtils.onToggle(config.showPercentage) { + ConditionalUtils.onToggle(config.showPercentage) { tracker.update() } } @@ -172,7 +177,7 @@ object SeaCreatureTracker { } @SubscribeEvent - fun onTick (event: LorenzTickEvent) { + fun onTick(event: LorenzTickEvent) { if (lastArmorCheck.passedSince() < 3.seconds) return lastArmorCheck = SimpleTimeMark.now() isTrophyFishing = isWearingTrophyArmor() 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 99b8240a6..bdd085ac1 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 @@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class 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 2775becc7..dcafc6603 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 @@ -14,6 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.input.Keyboard class TrophyFishFillet { + @SubscribeEvent fun onTooltip(event: LorenzToolTipEvent) { if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt index 6be896fb3..311661ed7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt @@ -1,12 +1,12 @@ package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson +import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson.TrophyFishInfo import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.splitLines -import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson -import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson.TrophyFishInfo import net.minecraft.event.HoverEvent import net.minecraft.util.ChatComponentText import net.minecraft.util.ChatStyle 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 c152de886..507e3e7bb 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 @@ -6,10 +6,10 @@ import at.hannibal2.skyhanni.config.features.fishing.trophyfishing.ChatMessagesC import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.fishes import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.getTooltip +import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.sumAllValues import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut -import at.hannibal2.skyhanni.utils.LorenzUtils.sumAllValues import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.ordinal import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -18,6 +18,7 @@ import net.minecraft.util.ChatComponentText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TrophyFishMessages { + private val trophyFishPattern = "§6§lTROPHY FISH! §r§bYou caught an? §r(?§[0-9a-f](?:§k)?[\\w -]+) §r(?§[0-9a-f]§l\\w+)§r§b\\.".toPattern() private val config get() = SkyHanniMod.feature.fishing.trophyFishing.chatMessages @@ -51,12 +52,15 @@ class TrophyFishMessages { var edited = original if (config.enabled) { - edited = ChatComponentText("§6§lTROPHY FISH! " + when (config.design) { - DesignFormat.STYLE_1 -> if (amount == 1) "§c§lFIRST §r$displayRarity $displayName" - else "§7$amount. §r$displayRarity $displayName" - DesignFormat.STYLE_2 -> "§bYou caught a $displayName $displayRarity§b. §7(${amount.addSeparators()})" - else -> "§bYou caught your ${amount.addSeparators()}${amount.ordinal()} $displayRarity $displayName§b." - }) + edited = ChatComponentText( + "§6§lTROPHY FISH! " + when (config.design) { + DesignFormat.STYLE_1 -> if (amount == 1) "§c§lFIRST §r$displayRarity $displayName" + else "§7$amount. §r$displayRarity $displayName" + + DesignFormat.STYLE_2 -> "§bYou caught a $displayName $displayRarity§b. §7(${amount.addSeparators()})" + else -> "§bYou caught your ${amount.addSeparators()}${amount.ordinal()} $displayRarity $displayName§b." + } + ) } if (config.totalAmount) { @@ -79,7 +83,7 @@ class TrophyFishMessages { private fun shouldBlockTrophyFish(rarity: TrophyRarity, amount: Int) = config.bronzeHider && rarity == TrophyRarity.BRONZE && amount != 1 - || config.silverHider && rarity == TrophyRarity.SILVER && amount != 1 + || config.silverHider && rarity == TrophyRarity.SILVER && amount != 1 @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt index 7f3ff8524..e376d97f2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt @@ -11,6 +11,7 @@ enum class TrophyRarity(val formatCode: String) { val formattedString get() = "$formatCode${name.firstLetterUppercase()}" companion object { + fun getByName(rawName: String) = entries.firstOrNull { rawName.uppercase().endsWith(it.name) } } -} \ No newline at end of file +} 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 e92fda526..19d658c2a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -6,13 +6,14 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems @@ -23,10 +24,12 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AnitaMedalProfit { + private val config get() = GardenAPI.config.anitaShop private var display = emptyList>() companion object { + var inInventory = false } @@ -104,7 +107,7 @@ class AnitaMedalProfit { for (rawItemName in requiredItems) { val pair = ItemUtils.readItemAmount(rawItemName) if (pair == null) { - LorenzUtils.error("Could not read item '$rawItemName'") + ChatUtils.error("Could not read item '$rawItemName'") continue } 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 73fd9804c..9fddb9fc6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt @@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.Season -import io.github.moulberry.notenoughupdates.util.SkyBlockTime import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AtmosphericFilterDisplay { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt index 22d553ea4..c11c2640d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt @@ -7,8 +7,9 @@ enum class CropAccessory( val internalName: NEUInternalName?, private val affectedCrops: Set, private val fortune: Double, - val upgradeCost: Pair? + val upgradeCost: Pair?, ) { + NONE(null, emptySet(), 0.0, null), CROPIE( "CROPIE_TALISMAN".asInternalName(), @@ -29,6 +30,7 @@ enum class CropAccessory( } companion object { + fun getByName(internalName: NEUInternalName) = entries.firstOrNull { internalName == it.internalName } } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt index 3a7226cc4..968fb1b29 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt @@ -15,34 +15,45 @@ enum class CropType( val simpleName: String, val replenish: Boolean = false, ) { - WHEAT("Wheat", "THEORETICAL_HOE_WHEAT", "CROPIE", 1.0, + + WHEAT( + "Wheat", "THEORETICAL_HOE_WHEAT", "CROPIE", 1.0, { ItemStack(Items.wheat) }, "wheat" ), - CARROT("Carrot", "THEORETICAL_HOE_CARROT", "CROPIE", 3.0, + CARROT( + "Carrot", "THEORETICAL_HOE_CARROT", "CROPIE", 3.0, { ItemStack(Items.carrot) }, "carrot", replenish = true ), - POTATO("Potato", "THEORETICAL_HOE_POTATO", "CROPIE", 3.0, + POTATO( + "Potato", "THEORETICAL_HOE_POTATO", "CROPIE", 3.0, { ItemStack(Items.potato) }, "potato", replenish = true ), - NETHER_WART("Nether Wart", "THEORETICAL_HOE_WARTS", "FERMENTO", 2.5, + NETHER_WART( + "Nether Wart", "THEORETICAL_HOE_WARTS", "FERMENTO", 2.5, { ItemStack(Items.nether_wart) }, "wart", replenish = true ), - PUMPKIN("Pumpkin", "PUMPKIN_DICER", "SQUASH", 1.0, + PUMPKIN( + "Pumpkin", "PUMPKIN_DICER", "SQUASH", 1.0, { ItemStack(Blocks.pumpkin) }, "pumpkin" ), - MELON("Melon", "MELON_DICER", "SQUASH", 5.0, + MELON( + "Melon", "MELON_DICER", "SQUASH", 5.0, { ItemStack(Items.melon) }, "melon" ), - COCOA_BEANS("Cocoa Beans", "COCO_CHOPPER", "SQUASH", 3.0, + COCOA_BEANS( + "Cocoa Beans", "COCO_CHOPPER", "SQUASH", 3.0, { ItemStack(Items.dye, 1, EnumDyeColor.BROWN.dyeDamage) }, "cocoa", replenish = true ), - SUGAR_CANE("Sugar Cane", "THEORETICAL_HOE_CANE", "FERMENTO", 2.0, + SUGAR_CANE( + "Sugar Cane", "THEORETICAL_HOE_CANE", "FERMENTO", 2.0, { ItemStack(Items.reeds) }, "cane" ), - CACTUS("Cactus", "CACTUS_KNIFE", "FERMENTO", 2.0, + CACTUS( + "Cactus", "CACTUS_KNIFE", "FERMENTO", 2.0, { ItemStack(Blocks.cactus) }, "cactus" ), - MUSHROOM("Mushroom", "FUNGI_CUTTER", "FERMENTO", 1.0, + MUSHROOM( + "Mushroom", "FUNGI_CUTTER", "FERMENTO", 1.0, { ItemStack(Blocks.red_mushroom_block) }, "mushroom" ), ; @@ -54,6 +65,7 @@ enum class CropType( override fun toString(): String = cropName companion object { + fun getByNameOrNull(itemName: String): CropType? { if (itemName == "Red Mushroom" || itemName == "Brown Mushroom") return MUSHROOM if (itemName == "Seeds") return WHEAT diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index c7f05d807..5b066b142 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -14,11 +14,11 @@ import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.CropType.Companion.getTurboCrop import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon import at.hannibal2.skyhanni.features.garden.pests.PestAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderString @@ -36,6 +36,7 @@ import kotlin.math.log10 import kotlin.time.Duration.Companion.seconds class FarmingFortuneDisplay { + private val tabFortuneUniversalPattern = " Farming Fortune: §r§6☘(?\\d+)".toPattern() private val tabFortuneCropPattern = " (?Wheat|Carrot|Potato|Pumpkin|Sugar Cane|Melon|Cactus|Cocoa Beans|Mushroom|Nether Wart) Fortune: §r§6☘(?\\d+)".toPattern() @@ -170,6 +171,7 @@ class FarmingFortuneDisplay { } companion object { + private val config get() = GardenAPI.config.farmingFortunes private val latestFF: MutableMap? get() = GardenAPI.storage?.latestTrueFarmingFortune diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingMilestoneCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingMilestoneCommand.kt index 7f7832ff1..61e3d1caa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingMilestoneCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingMilestoneCommand.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraft.command.CommandBase @@ -12,12 +12,12 @@ object FarmingMilestoneCommand { fun onCommand(crop: String?, current: String?, target: String?, needsTime: Boolean) { if (crop == null) { - LorenzUtils.userError("No crop type entered") + ChatUtils.userError("No crop type entered") return } val enteredCrop = CropType.entries.firstOrNull { it.simpleName == crop.lowercase() } ?: run { - LorenzUtils.userError("Invalid crop type entered") + ChatUtils.userError("Invalid crop type entered") return } @@ -30,7 +30,7 @@ object FarmingMilestoneCommand { val cropsForTier = GardenCropMilestones.getCropsForTier(currentCropMilestone, enteredCrop) val output = (cropsForTier - currentProgress).formatOutput(needsTime, enteredCrop) - LorenzUtils.chat("§7$output needed to reach the next milestone") + ChatUtils.chat("§7$output needed to reach the next milestone") return } @@ -38,11 +38,11 @@ object FarmingMilestoneCommand { val cropsForTier = GardenCropMilestones.getCropsForTier(currentMilestone, enteredCrop) val output = cropsForTier.formatOutput(needsTime, enteredCrop) - LorenzUtils.chat("§7$output needed for milestone §7$currentMilestone") + ChatUtils.chat("§7$output needed for milestone §7$currentMilestone") return } if (currentMilestone >= targetMilestone) { - LorenzUtils.userError("Entered milestone is greater than or the same as target milestone") + ChatUtils.userError("Entered milestone is greater than or the same as target milestone") return } @@ -50,7 +50,7 @@ object FarmingMilestoneCommand { val targetAmount = GardenCropMilestones.getCropsForTier(targetMilestone, enteredCrop) val output = (targetAmount - currentAmount).formatOutput(needsTime, enteredCrop) - LorenzUtils.chat("§7$output needed for milestone §7$currentMilestone §a-> §7$targetMilestone") + ChatUtils.chat("§7$output needed for milestone §7$currentMilestone §a-> §7$targetMilestone") } fun onComplete(strings: Array): List { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index dffb6f0ef..cf9fbea6f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -24,13 +24,13 @@ import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems import at.hannibal2.skyhanni.features.garden.inventory.SkyMartCopperPrice import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.utils.BlockUtils.isBabyCrop +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside import at.hannibal2.skyhanni.utils.LorenzRarity -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUInternalName @@ -45,6 +45,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds object GardenAPI { + var toolInHand: String? = null var itemInHand: ItemStack? = null var cropInHand: CropType? = null @@ -159,7 +160,7 @@ object GardenAPI { storage?.cropsPerSecond?.clear() GardenBestCropTime.reset() updateGardenTool() - LorenzUtils.chat("Manually reset all crop speed data!") + ChatUtils.chat("Manually reset all crop speed data!") } @SubscribeEvent 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 495d82bb6..838b3f6ce 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt @@ -7,13 +7,14 @@ import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.farming.GardenCropMilestoneDisplay -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenCropMilestoneFix { + private val tabListPattern = " Milestone: §r§a(?.*) (?.*): §r§3(?.*)%".toPattern() private val levelUpPattern = " {2}§r§b§lGARDEN MILESTONE §3(?.*) §8.*➜§3(?.*)".toPattern() @@ -51,7 +52,7 @@ class GardenCropMilestoneFix { val crop = CropType.getByNameOrNull(cropName) if (crop == null) { - LorenzUtils.debug("GardenCropMilestoneFix: crop is null: '$cropName'") + ChatUtils.debug("GardenCropMilestoneFix: crop is null: '$cropName'") return } @@ -81,11 +82,11 @@ class GardenCropMilestoneFix { crop.setCounter(tabListValue) GardenCropMilestoneDisplay.update() if (!loadedCrops.contains(crop)) { - LorenzUtils.chat("Loaded ${crop.cropName} milestone data from $source!") + ChatUtils.chat("Loaded ${crop.cropName} milestone data from $source!") loadedCrops.add(crop) } } else if (diff >= minDiff) { - LorenzUtils.debug("Fixed wrong ${crop.cropName} milestone data from $source: ${diff.addSeparators()}") + ChatUtils.debug("Fixed wrong ${crop.cropName} milestone data from $source: ${diff.addSeparators()}") crop.setCounter(tabListValue) GardenCropMilestoneDisplay.update() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt index 6629f1b00..42d417a5a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt @@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.features.garden.farming.CropMoneyDisplay import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.ItemUtils.getItemName -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber @@ -12,16 +12,17 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils object GardenCropTimeCommand { + private val config get() = GardenAPI.config.moneyPerHours fun onCommand(args: Array) { if (!config.display) { - LorenzUtils.userError("shcroptime requires 'Show money per Hour' feature to be enabled to work!") + ChatUtils.userError("shcroptime requires 'Show money per Hour' feature to be enabled to work!") return } if (args.size < 2) { - LorenzUtils.userError("Usage: /shcroptime ") + ChatUtils.userError("Usage: /shcroptime ") return } @@ -29,12 +30,12 @@ object GardenCropTimeCommand { val amount = try { rawAmount.formatNumber() } catch (e: NumberFormatException) { - LorenzUtils.userError("Not a valid number: '$rawAmount'") + ChatUtils.userError("Not a valid number: '$rawAmount'") return } val multipliers = CropMoneyDisplay.multipliers if (multipliers.isEmpty()) { - LorenzUtils.userError("Data not loaded yet. Join the garden and display the money per hour display.") + ChatUtils.userError("Data not loaded yet. Join the garden and display the money per hour display.") return } @@ -69,10 +70,10 @@ object GardenCropTimeCommand { } if (map.isEmpty()) { - LorenzUtils.userError("No crop item found for '$rawSearchName'.") + ChatUtils.userError("No crop item found for '$rawSearchName'.") return } - LorenzUtils.chat("Crop Speed for ${map.size} items:\n" + map.sorted().keys.joinToString("\n")) + ChatUtils.chat("Crop Speed for ${map.size} items:\n" + map.sorted().keys.joinToString("\n")) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt index 768dcbc49..4bf34a5ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt @@ -2,25 +2,26 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.features.garden.farming.CropMoneyDisplay import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.ItemUtils.getItemName -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils object GardenCropsInCommand { + private val config get() = GardenAPI.config.moneyPerHours fun onCommand(args: Array) { if (!config.display) { - LorenzUtils.userError("shcropsin requires 'Show money per Hour' feature to be enabled to work!") + ChatUtils.userError("shcropsin requires 'Show money per Hour' feature to be enabled to work!") return } if (args.size < 2) { - LorenzUtils.userError("Usage: /shcropsin