diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt | 4 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt | 31 |
2 files changed, 28 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt index a4b86e03c..52dcd86b6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt @@ -135,7 +135,9 @@ class GardenVisitorTimer { val factor = diff / 1000.0 "§7/§$formatColor" + TimeUtils.formatDuration((millis / factor).roundToLong()) } else "" - + if (config.pingForVisitorArrivals && millis < 10000){ + SoundUtils.playBeepSound() + } val formatDuration = TimeUtils.formatDuration(millis) val next = if (queueFull && (!isSixthVisitorEnabled() || millis < 0)) "§cQueue Full!" else { "Next in §$formatColor$formatDuration$extraSpeed" 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 98a48a76a..96ec316a1 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 @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.visitor +import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -12,6 +13,9 @@ import at.hannibal2.skyhanni.events.garden.visitor.VisitorRenderEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorToolTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI.VisitorStatus +import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI.config +import at.hannibal2.skyhanni.mixins.transformers.gui.AccessorGuiContainer +import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld @@ -22,8 +26,10 @@ import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation import at.hannibal2.skyhanni.utils.StringUtils.removeColor import io.github.moulberry.notenoughupdates.events.SlotClickEvent import net.minecraft.client.Minecraft +import net.minecraft.client.gui.inventory.GuiContainer import net.minecraft.entity.item.EntityArmorStand import net.minecraft.network.play.client.C02PacketUseEntity +import net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -103,7 +109,7 @@ class VisitorListener { } for (name in visitorsInTab) { - VisitorAPI.addVisitor(name) + VisitorAPI.addVisitor(name) } } @@ -112,7 +118,7 @@ class VisitorListener { if (!GardenAPI.inGarden()) return val npcItem = event.inventoryItems[VISITOR_INFO_ITEM_SLOT] ?: return val lore = npcItem.getLore() - if(!VisitorAPI.isVisitorInfo(lore)) return + if (!VisitorAPI.isVisitorInfo(lore)) return val offerItem = event.inventoryItems[VISITOR_ACCEPT_ITEM_SLOT] ?: return if (offerItem.name != "§aAccept Offer") return @@ -138,6 +144,17 @@ class VisitorListener { VisitorAPI.inInventory = false } + @SubscribeEvent + fun onKeybind(event: KeyboardInputEvent.Post) { + if (!VisitorAPI.inInventory) return + if (!config.acceptHotkey.isKeyHeld()) return + val inventory = event.gui as? AccessorGuiContainer ?: return + inventory as GuiContainer + val slot = inventory.inventorySlots.getSlot(29) + inventory.handleMouseClick_skyhanni(slot, slot.slotIndex, 0, 0) + } + + @SubscribeEvent(priority = EventPriority.HIGH) fun onStackClick(event: SlotClickEvent) { if (!VisitorAPI.inInventory) return @@ -158,8 +175,8 @@ class VisitorListener { LorenzUtils.chat("§e[SkyHanni] §cBlocked refusing visitor ${visitor.visitorName} §7(${it.displayName}§7)") if (config.rewardWarning.bypassKey == Keyboard.KEY_NONE) { LorenzUtils.clickableChat( - "§eIf you want to deny this visitor, set a keybind in §e/sh bypass", - "sh bypass" + "§eIf you want to deny this visitor, set a keybind in §e/sh bypass", + "sh bypass" ) } Minecraft.getMinecraft().thePlayer.closeScreen() @@ -170,7 +187,9 @@ class VisitorListener { VisitorAPI.changeStatus(visitor, VisitorStatus.REFUSED, "refused") return } - if (event.slotId == VISITOR_ACCEPT_ITEM_SLOT && event.slot.stack?.getLore()?.any { it == "§eClick to give!" } == true) { + if (event.slotId == VISITOR_ACCEPT_ITEM_SLOT && event.slot.stack?.getLore() + ?.any { it == "§eClick to give!" } == true + ) { VisitorAPI.changeStatus(visitor, VisitorStatus.ACCEPTED, "accepted") return } @@ -209,4 +228,4 @@ class VisitorListener { } } } -}
\ No newline at end of file +} |