diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-05-31 02:01:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-31 02:01:17 +0200 |
commit | e64ef144b0bab409d0d4edbef12b42744dbbf9a8 (patch) | |
tree | 2868fa5c38406cff23fc66544185db527b11fdce /src | |
parent | 60cb0823bcc72f901c1e8fdc3a35b2cb59809989 (diff) | |
download | skyhanni-e64ef144b0bab409d0d4edbef12b42744dbbf9a8.tar.gz skyhanni-e64ef144b0bab409d0d4edbef12b42744dbbf9a8.tar.bz2 skyhanni-e64ef144b0bab409d0d4edbef12b42744dbbf9a8.zip |
Improvement: /shclearminiondata (#1951)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src')
3 files changed, 22 insertions, 26 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index e0f4d1240..5184f72b1 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -662,7 +662,7 @@ class SkyHanniMod { loadModule(AshfangHideParticles()) loadModule(AshfangHideDamageIndicator()) loadModule(ItemStars()) - loadModule(MinionFeatures()) + loadModule(MinionFeatures) loadModule(TimeFeatures()) loadModule(RngMeterInventory()) loadModule(WikiManager) 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 884a2c140..61b24c76c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -345,8 +345,8 @@ object Commands { ) { GardenAPI.clearCropSpeed() } registerCommand( "shclearminiondata", - "Reset data about minion profit and the name display on the private island" - ) { MinionFeatures.clearMinionData() } + "Removed bugged minion locations from your private island" + ) { MinionFeatures.removeBuggedMinions(isCommand = true) } registerCommand( "shwhereami", "Print current island in chat" diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index feadbd108..bad1fe543 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -59,7 +59,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color -class MinionFeatures { +object MinionFeatures { private val config get() = SkyHanniMod.feature.misc.minions private var lastClickedEntity: LorenzVec? = null @@ -175,7 +175,6 @@ class MinionFeatures { val minions = minions ?: return val entity = lastClickedEntity ?: return - val openInventory = event.inventoryName val name = getMinionName(openInventory) if (!minions.contains(entity) && LorenzUtils.skyBlockIsland != IslandType.HUB) { @@ -198,7 +197,7 @@ class MinionFeatures { lastMinionOpened = 0 } - private fun removeBuggedMinions() { + fun removeBuggedMinions(isCommand: Boolean = false) { if (!IslandType.PRIVATE_ISLAND.isInIsland()) return val minions = minions ?: return @@ -212,8 +211,13 @@ class MinionFeatures { } val size = removedEntities.size - if (size == 0) return - Companion.minions = minions.editCopy { + if (size == 0) { + if (isCommand) { + ChatUtils.chat("No bugged minions found nearby.") + } + return + } + this.minions = minions.editCopy { for (removedEntity in removedEntities) { remove(removedEntity) } @@ -396,26 +400,18 @@ class MinionFeatures { } } - companion object { + var lastMinion: LorenzVec? = null + var lastStorage: LorenzVec? = null + var minionInventoryOpen = false + var minionStorageInventoryOpen = false - var lastMinion: LorenzVec? = null - var lastStorage: LorenzVec? = null - var minionInventoryOpen = false - var minionStorageInventoryOpen = false - - private var minions: Map<LorenzVec, ProfileSpecificStorage.MinionConfig>? - get() { - return ProfileStorageData.profileSpecific?.minions - } - set(value) { - ProfileStorageData.profileSpecific?.minions = value - } - - fun clearMinionData() { - minions = mutableMapOf() - ChatUtils.chat("Manually reset all private island minion location data!") + private var minions: Map<LorenzVec, ProfileSpecificStorage.MinionConfig>? + get() { + return ProfileStorageData.profileSpecific?.minions + } + set(value) { + ProfileStorageData.profileSpecific?.minions = value } - } @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { |