Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class ChatConfig {
desc = "Right click a chat message to copy it. Holding Shift will copy the message with " +
"Shwords applied, and holding Ctrl will copy only one line."
)
@SearchTag("control")
@ConfigEditorBoolean
@FeatureToggle
var copyChat: Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.google.gson.annotations.Expose
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption
import io.github.notenoughupdates.moulconfig.annotations.SearchTag

class HideNotClickableConfig {

Expand Down Expand Up @@ -42,8 +43,10 @@ class HideNotClickableConfig {
@Expose
@ConfigOption(
name = "Bypass With Key",
desc = "Add the ability to bypass not clickable items when holding the control/command key.",
desc = "Add the ability to bypass not clickable items when holding the Control key " +
"(Command on macOS)",
)
@SearchTag("cmd ctrl")
@ConfigEditorBoolean
var itemsBypass: Boolean = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableLi
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption
import io.github.notenoughupdates.moulconfig.annotations.SearchTag

private const val EVOLVING_ITEMS_SEARCH_TAG =
"Time Pocket, Bottle of Jyrre, Dark Cacao Truffle, Discrite, Moby-Duck, Rosewater Flask"

class InventoryConfig {
@Expose
@Category(name = "SkyBlock Guide", desc = "Help find stuff to do in SkyBlock.")
Expand Down Expand Up @@ -170,7 +173,7 @@ class InventoryConfig {
@Expose
@ConfigOption(name = "Evolving Items", desc = "")
@Accordion
@SearchTag("Time Pocket, Bottle of Jyrre, Dark Cacao Truffle, Discrite, Moby-Duck")
@SearchTag(EVOLVING_ITEMS_SEARCH_TAG)
val evolvingItems: EvolvingItemsConfig = EvolvingItemsConfig()

@Expose
Expand All @@ -179,9 +182,9 @@ class InventoryConfig {
val trade: TradeConfig = TradeConfig()

@Expose
@ConfigOption(name = "Item Number", desc = "Showing the item number as a stack size for these items.")
@ConfigOption(name = "Item Number", desc = "Show the item number as a stack size for these items.")
@ConfigEditorDraggableList
@SearchTag("Time Pocket, Bottle of Jyrre, Dark Cacao Truffle, Discrite, Moby-Duck")
@SearchTag(EVOLVING_ITEMS_SEARCH_TAG)
val itemNumberAsStackSize: MutableList<ItemNumberEntry> = mutableListOf(
ItemNumberEntry.NEW_YEAR_CAKE,
ItemNumberEntry.RANCHERS_BOOTS_SPEED,
Expand Down Expand Up @@ -228,9 +231,10 @@ class InventoryConfig {
@Expose
@ConfigOption(
name = "Quick Craft Confirmation",
desc = "Require Ctrl+Click to craft items that aren't often quick crafted " +
"(e.g. armor, weapons, accessories). Sack items can be crafted normally.",
desc = "Require Ctrl+Click (Cmd+Click on macOS) to craft items that aren't often quick " +
"crafted (e.g. armor, weapons, accessories). Sack items can be crafted normally.",
)
@SearchTag("command control")
@ConfigEditorBoolean
@FeatureToggle
var quickCraftingConfirmation: Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package at.hannibal2.skyhanni.events

import at.hannibal2.skyhanni.data.repo.AbstractRepoManager
import at.hannibal2.skyhanni.data.repo.AbstractRepoReloadEvent
import at.hannibal2.skyhanni.skyhannimodule.PrimaryFunction

@PrimaryFunction("onNeuRepositoryReload")
class NeuRepositoryReloadEvent(
override val manager: AbstractRepoManager<NeuRepositoryReloadEvent>
) : AbstractRepoReloadEvent(manager)
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ object StashCompact {

pickupStashPattern.matchMatcher(event.message) {
event.blockedReason = REASON
ChatUtils.deleteNextMessage(REASON) { StringUtils.isEmpty(it) }
ChatUtils.deleteNextMessage(REASON) { StringUtils.isEmpty(it.string) }
val currentType = currentType ?: return@matchMatcher

val currentMessage = currentMessages[currentType] ?: return@matchMatcher
Expand All @@ -145,7 +145,7 @@ object StashCompact {
if (!config.hideAddedMessages) return
genericAddedToStashPattern.matchMatcher(event.message) {
event.blockedReason = REASON
ChatUtils.deleteNextMessage(REASON) { StringUtils.isEmpty(it) }
ChatUtils.deleteNextMessage(REASON) { StringUtils.isEmpty(it.string) }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ import at.hannibal2.skyhanni.data.SackApi.isMissingSackItem
import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson
import at.hannibal2.skyhanni.data.model.ComposterUpgrade
import at.hannibal2.skyhanni.data.model.TabWidget
import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.DebugDataCollectEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent
import at.hannibal2.skyhanni.events.IslandJoinEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.events.WidgetUpdateEvent
import at.hannibal2.skyhanni.events.minecraft.ToolTipTextEvent
Expand Down Expand Up @@ -134,7 +131,7 @@ object ComposterOverlay {
}
}

@HandleEvent(InventoryFullyOpenedEvent::class, onlyOnIsland = IslandType.GARDEN)
@HandleEvent(onlyOnIsland = IslandType.GARDEN)
fun onInventoryFullyOpened() {
if (inInventory) displayDirty = true
}
Expand Down Expand Up @@ -508,7 +505,7 @@ object ComposterOverlay {

add("")
if (selected) {
add(internalName.createBuyTipLine("Control + "))
add(internalName.createBuyTipLine("${KeyboardManager.getModifierKeyName()} + "))
} else {
add("§eClick to select for profit calculations!")
}
Expand Down Expand Up @@ -600,15 +597,14 @@ object ComposterOverlay {
return price
}

@HandleEvent(NeuRepositoryReloadEvent::class)
fun onNeuRepoReload() {
fun onNeuRepositoryReload() {
updateOrganicMatterFactors()
}

// hopefully fix the display not working properly
@HandleEvent
fun onIslandSwap(event: IslandChangeEvent) {
if (event.newIsland != IslandType.GARDEN) return
fun onIslandJoin(event: IslandJoinEvent) {
if (event.island != IslandType.GARDEN) return
updateOrganicMatterFactors()
}

Expand All @@ -620,7 +616,7 @@ object ComposterOverlay {
updateOrganicMatterFactors()
}

@HandleEvent(ConfigLoadEvent::class)
@HandleEvent
fun onConfigLoad() {
with(config) {
ConditionalUtils.onToggle(minimumOrganicMatter) {
Expand Down Expand Up @@ -708,7 +704,7 @@ object ComposterOverlay {
}

@HandleEvent
fun onDebug(event: DebugDataCollectEvent) {
fun onDebugDataCollect(event: DebugDataCollectEvent) {
event.title("Garden Composter")

event.addIrrelevant {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import at.hannibal2.skyhanni.data.hotx.HotmData
import at.hannibal2.skyhanni.data.hotx.HotmReward
import at.hannibal2.skyhanni.data.model.SkyblockStat
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.minecraft.SkyHanniTickEvent
import at.hannibal2.skyhanni.features.dungeon.DungeonApi
import at.hannibal2.skyhanni.features.nether.kuudra.KuudraApi
import at.hannibal2.skyhanni.features.rift.RiftApi
Expand Down Expand Up @@ -241,7 +238,7 @@ object BlockStrengthGuide {

if (!showExtraInfos) {
add(Renderable.placeholder(0, 5))
addString("§eHold control-key to show extra infos!")
addString("§eHold ${KeyboardManager.getModifierKeyName()} key to show extra infos!")
}
},
)
Expand Down Expand Up @@ -513,7 +510,7 @@ object BlockStrengthGuide {
}
}

@HandleEvent(SkyHanniTickEvent::class)
@HandleEvent
fun onTick() {
val now = KeyboardManager.isModifierKeyDown()
if (showExtraInfos != now) {
Expand All @@ -522,14 +519,14 @@ object BlockStrengthGuide {
}
}

@HandleEvent(InventoryCloseEvent::class)
@HandleEvent
fun onInventoryClose() {
if (!statsOpened) return
shouldBlockSHMenu = false
}

@HandleEvent(IslandChangeEvent::class)
fun onIslandChange() {
@HandleEvent
fun onWorldChange() {
shouldBlockSHMenu = false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package at.hannibal2.skyhanni.test.graph
import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.data.model.graph.Graph
import at.hannibal2.skyhanni.data.model.graph.GraphNodeTag
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.GraphUtils.distanceSqToPlayer
Expand Down Expand Up @@ -38,8 +37,8 @@ object GraphNodeEditor {
private var lastUpdate = SimpleTimeMark.farPast()
private val tagsToShow: MutableList<GraphNodeTag> = GraphNodeTag.entries.toMutableList()

@HandleEvent(GuiRenderEvent.GuiOnTopRenderEvent::class)
fun onRenderOverlay() {
@HandleEvent
fun onGuiRenderTop() {
doRender()
}

Expand Down Expand Up @@ -246,7 +245,7 @@ object GraphNodeEditor {
}

add("§eClick to select/deselect this node!")
add("§eControl-Click to edit the tags for this node!")
add("§e${KeyboardManager.getModifierKeyName()}-Click to edit the tags for this node!")

},
onLeftClick = {
Expand Down
19 changes: 10 additions & 9 deletions src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,23 @@ import net.minecraft.client.GuiMessage
import net.minecraft.client.Minecraft
import net.minecraft.network.chat.Component
import net.minecraft.network.chat.MutableComponent
import java.lang.UnsupportedOperationException
import java.util.LinkedList
import java.util.Queue
import kotlin.reflect.KProperty0
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.times

private const val DEBUG_PREFIX = "[SkyHanni Debug] §7"
private const val USER_ERROR_PREFIX = "§c[SkyHanni] "
private const val CHAT_PREFIX = "[SkyHanni] "

@SkyHanniModule
object ChatUtils {

// TODO log based on chat category (error, warning, debug, user error, normal)
private val log = SkyHanniLogger("chat/mod_sent")
var lastButtonClicked = 0L

private const val DEBUG_PREFIX = "[SkyHanni Debug] §7"
private const val USER_ERROR_PREFIX = "§c[SkyHanni] "
private const val CHAT_PREFIX = "[SkyHanni] "

/**
* Sends a debug message to the chat and the console.
* This is only sent if the debug feature is enabled.
Expand Down Expand Up @@ -359,14 +358,14 @@ object ChatUtils {
}
}

private var deleteNext: Pair<String, (String) -> Boolean>? = null
private var deleteNext: Pair<String, (Component) -> Boolean>? = null

@HandleEvent(priority = HandleEvent.HIGH)
fun onChat(event: SkyHanniChatEvent.Allow) {
val (reason, predicate) = deleteNext ?: return
this.deleteNext = null

if (predicate(event.message)) {
if (predicate(event.chatComponent)) {
event.blockedReason = reason
}
}
Expand All @@ -379,7 +378,7 @@ object ChatUtils {

fun deleteNextMessage(
reason: String,
predicate: (String) -> Boolean,
predicate: (Component) -> Boolean,
) {
deleteNext = reason to predicate
}
Expand Down Expand Up @@ -441,6 +440,7 @@ object ChatUtils {
) {
val hint = if (SkyHanniMod.feature.chat.hideClickableHint) "" else
"\n§e[CLICK to $actionName or disable this feature]"
val modifier = KeyboardManager.getModifierKeyName()
clickableChat(
"$message$hint",
onClick = {
Expand All @@ -450,7 +450,8 @@ object ChatUtils {
action()
}
},
hover = "§eClick to $actionName!\n§eShift-Click or Control-Click to disable this feature!",
hover = "§eClick to $actionName!\n" +
"§eShift-Click or $modifier-Click to disable this feature!",
oneTimeClick = oneTimeClick,
replaceSameMessage = true,
)
Expand Down
Loading
Loading