diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-17 12:31:14 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-17 12:31:14 +0200 |
commit | 61a018ba4e1a3cfa249c4809262f607820b3f811 (patch) | |
tree | b4ff2e96fe983154915cdbabc15448f5426ae507 /src/main | |
parent | 48a41d5dd03a7fa591827f3bcb0f9d6f2dc27e9a (diff) | |
download | skyhanni-61a018ba4e1a3cfa249c4809262f607820b3f811.tar.gz skyhanni-61a018ba4e1a3cfa249c4809262f607820b3f811.tar.bz2 skyhanni-61a018ba4e1a3cfa249c4809262f607820b3f811.zip |
code cleanup
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorAcceptEvent.kt (renamed from src/main/java/at/hannibal2/skyhanni/events/VisitorAcceptEvent.kt) | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorRenderEvent.kt | 4 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorToolTipEvent.kt | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt | 19 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt | 24 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt | 8 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt | 3 |
9 files changed, 35 insertions, 34 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/events/VisitorAcceptEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorAcceptEvent.kt index af6fa275a..4a494f353 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/VisitorAcceptEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorAcceptEvent.kt @@ -1,5 +1,6 @@ -package at.hannibal2.skyhanni.events +package at.hannibal2.skyhanni.events.garden.visitor +import at.hannibal2.skyhanni.events.LorenzEvent import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI class VisitorAcceptEvent(val visitor: VisitorAPI.Visitor) : LorenzEvent()
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorRenderEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorRenderEvent.kt index f050d53a5..7cbdc8224 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorRenderEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorRenderEvent.kt @@ -4,6 +4,6 @@ import at.hannibal2.skyhanni.events.LorenzEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.utils.LorenzVec -import net.minecraftforge.client.event.RenderWorldLastEvent -class VisitorRenderEvent(val visitor: VisitorAPI.Visitor, val location: LorenzVec, val parent: LorenzRenderWorldEvent) : LorenzEvent()
\ No newline at end of file +class VisitorRenderEvent(val visitor: VisitorAPI.Visitor, val location: LorenzVec, val parent: LorenzRenderWorldEvent) : + LorenzEvent()
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorToolTipEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorToolTipEvent.kt index daf1439f3..1bee8cff6 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorToolTipEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/garden/visitor/VisitorToolTipEvent.kt @@ -4,4 +4,5 @@ import at.hannibal2.skyhanni.events.LorenzEvent import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import net.minecraft.item.ItemStack -class VisitorToolTipEvent(val visitor: VisitorAPI.Visitor, val itemStack: ItemStack, val toolTip: MutableList<String>) : LorenzEvent()
\ No newline at end of file +class VisitorToolTipEvent(val visitor: VisitorAPI.Visitor, val itemStack: ItemStack, val toolTip: MutableList<String>) : + LorenzEvent()
\ 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 fd98cd437..d5c279fc9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent -import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorFeatures import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName @@ -48,7 +47,7 @@ class AnitaMedalProfit { fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!config.medalProfitEnabled) return if (event.inventoryName != "Anita") return - if (VisitorAPI.inVisitorInventory) return + if (VisitorAPI.inInventory) return inInventory = true diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt index 618f48e59..c4b7fc0a3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.PreProfileSwitchEvent -import at.hannibal2.skyhanni.events.VisitorAcceptEvent +import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 378b72e35..954f1278c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -1,6 +1,5 @@ package at.hannibal2.skyhanni.features.garden.visitor -import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -9,7 +8,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent import at.hannibal2.skyhanni.events.PreProfileSwitchEvent import at.hannibal2.skyhanni.events.TabListLineRenderEvent -import at.hannibal2.skyhanni.events.VisitorAcceptEvent +import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptedEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorArrivalEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorOpenEvent @@ -574,23 +573,23 @@ class GardenVisitorFeatures { event.move(3, "garden.visitorNeedsPos", "garden.visitors.needs.pos") event.move(3, "garden.visitorNeedsOnlyWhenClose", "garden.visitors.needs.onlyWhenClose") event.move(3, "garden.visitorNeedsInBazaarAlley", "garden.visitors.needs.inBazaarAlley") - event.move(3,"garden.visitorNeedsShowPrice", "garden.visitors.needs.showPrice") - event.move(3,"garden.visitorItemPreview", "garden.visitors.needs.itemPreview") + event.move(3, "garden.visitorNeedsShowPrice", "garden.visitors.needs.showPrice") + event.move(3, "garden.visitorItemPreview", "garden.visitors.needs.itemPreview") event.move(3, "garden.visitorShowPrice", "garden.visitors.inventory.showPrice") event.move(3, "garden.visitorExactAmountAndTime", "garden.visitors.inventory.exactAmountAndTime") event.move(3, "garden.visitorCopperPrice", "garden.visitors.inventory.copperPrice") event.move(3, "garden.visitorCopperTime", "garden.visitors.inventory.copperTime") event.move(3, "garden.visitorExperiencePrice", "garden.visitors.inventory.experiencePrice") - event.move(3,"garden.visitorRewardWarning.notifyInChat","garden.visitors.rewardWarning.notifyInChat") - event.move(3,"garden.visitorRewardWarning.showOverName","garden.visitors.rewardWarning.showOverName") - event.move(3,"garden.visitorRewardWarning.preventRefusing","garden.visitors.rewardWarning.preventRefusing") - event.move(3,"garden.visitorRewardWarning.bypassKey","garden.visitors.rewardWarning.bypassKey") - event.move(3,"garden.visitorRewardWarning.drops","garden.visitors.rewardWarning.drops") + event.move(3, "garden.visitorRewardWarning.notifyInChat", "garden.visitors.rewardWarning.notifyInChat") + event.move(3, "garden.visitorRewardWarning.showOverName", "garden.visitors.rewardWarning.showOverName") + event.move(3, "garden.visitorRewardWarning.preventRefusing", "garden.visitors.rewardWarning.preventRefusing") + event.move(3, "garden.visitorRewardWarning.bypassKey", "garden.visitors.rewardWarning.bypassKey") + event.move(3, "garden.visitorRewardWarning.drops", "garden.visitors.rewardWarning.drops") event.move(3, "garden.visitorNotificationChat", "garden.visitors.notificationChat") event.move(3, "garden.visitorNotificationTitle", "garden.visitors.notificationTitle") event.move(3, "garden.visitorHighlightStatus", "garden.visitors.highlightStatus") event.move(3, "garden.visitorColoredName", "garden.visitors.coloredName") - event.move(3,"garden.visitorHypixelArrivedMessage","garden.visitors.hypixelArrivedMessage") + event.move(3, "garden.visitorHypixelArrivedMessage", "garden.visitors.hypixelArrivedMessage") event.move(3, "garden.visitorHideChat", "garden.visitors.hideChat") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt index 4f9bbb23d..a1a7b5110 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt @@ -18,7 +18,7 @@ import net.minecraft.item.ItemStack object VisitorAPI { private var visitors = mapOf<String, Visitor>() - var inVisitorInventory = false + var inInventory = false val config get() = SkyHanniMod.feature.garden.visitors private val logger = LorenzLogger("garden/visitors/api") @@ -41,9 +41,11 @@ object VisitorAPI { VisitorStatus.ACCEPTED -> { VisitorAcceptedEvent(visitor).postAndCatch() } + VisitorStatus.REFUSED -> { VisitorRefusedEvent(visitor).postAndCatch() } + else -> {} } } @@ -62,8 +64,8 @@ object VisitorAPI { println("visitors: $visitors") println("name: $name") ErrorManager.logErrorState( - "Error finding the visitor `$name§c`. Try to reopen the inventory", - "visitor is null! name='$name', visitors=`$visitors`" + "Error finding the visitor `$name§c`. Try to reopen the inventory", + "visitor is null! name='$name', visitors=`$visitors`" ) return null } @@ -98,17 +100,17 @@ object VisitorAPI { } class VisitorOffer( - val offerItem: ItemStack + val offerItem: ItemStack ) class Visitor( - val visitorName: String, - var entityId: Int = -1, - var nameTagEntityId: Int = -1, - var status: VisitorStatus, - var inSacks: Boolean = false, - val items: MutableMap<NEUInternalName, Int> = mutableMapOf(), - var offer: VisitorOffer? = null, + val visitorName: String, + var entityId: Int = -1, + var nameTagEntityId: Int = -1, + var status: VisitorStatus, + var inSacks: Boolean = false, + val items: MutableMap<NEUInternalName, Int> = mutableMapOf(), + var offer: VisitorOffer? = null, ) { var lore: List<String> = emptyList() var allRewards = listOf<NEUInternalName>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt index c03d666f9..98a48a76a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt @@ -117,7 +117,7 @@ class VisitorListener { val offerItem = event.inventoryItems[VISITOR_ACCEPT_ITEM_SLOT] ?: return if (offerItem.name != "§aAccept Offer") return - VisitorAPI.inVisitorInventory = true + VisitorAPI.inInventory = true val visitorOffer = VisitorAPI.VisitorOffer(offerItem) @@ -135,12 +135,12 @@ class VisitorListener { @SubscribeEvent fun onInventoryClose(event: InventoryCloseEvent) { - VisitorAPI.inVisitorInventory = false + VisitorAPI.inInventory = false } @SubscribeEvent(priority = EventPriority.HIGH) fun onStackClick(event: SlotClickEvent) { - if (!VisitorAPI.inVisitorInventory) return + if (!VisitorAPI.inInventory) return if (event.clickType != 0) return val visitor = VisitorAPI.getVisitor(lastClickedNpc) ?: return @@ -179,7 +179,7 @@ class VisitorListener { @SubscribeEvent(priority = EventPriority.HIGH) fun onTooltip(event: ItemTooltipEvent) { if (!GardenAPI.onBarnPlot) return - if (!VisitorAPI.inVisitorInventory) return + if (!VisitorAPI.inInventory) return val visitor = VisitorAPI.getVisitor(lastClickedNpc) ?: return VisitorToolTipEvent(visitor, event.itemStack, event.toolTip).postAndCatch() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index 7e015b09c..97278e9f9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -8,7 +8,6 @@ import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay -import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorFeatures import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.features.rift.RiftAPI.motesNpcPrice @@ -386,7 +385,7 @@ class HideNotClickableItems { private fun hideNpcSell(chestName: String, stack: ItemStack): Boolean { if (!tradeNpcFilter.match(chestName)) return false - if (VisitorAPI.inVisitorInventory) return false + if (VisitorAPI.inInventory) return false reverseColor = true var name = stack.cleanName() |