Skip to content

Commit

Permalink
Merge branch 'refs/heads/beta' into repo-errors2
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt
#	src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
#	src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt
  • Loading branch information
NopoTheGamer committed Oct 5, 2024
2 parents 7c1d0f7 + 1c9fd3f commit 70e913f
Show file tree
Hide file tree
Showing 29 changed files with 169 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/label-bug-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: label
env:
TITLE: ${{ github.event.pull_request.title }}
LABEL: Bug Fix - Sooner than Very Soon
LABEL: Bug Fix
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN}}
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ dependencies {
exclude(module = "unspecified")
isTransitive = false
}
// August 27, 2024, 4:30 PM AEST
// https://github.com/NotEnoughUpdates/NotEnoughUpdates/tree/2.3.3
devenvMod("com.github.NotEnoughUpdates:NotEnoughUpdates:2.3.3:all") {
// October 3, 2024, 11:43 PM AEST
// https://github.com/NotEnoughUpdates/NotEnoughUpdates/tree/2.4.0
devenvMod("com.github.NotEnoughUpdates:NotEnoughUpdates:2.4.0:all") {
exclude(module = "unspecified")
isTransitive = false
}
Expand Down
2 changes: 1 addition & 1 deletion pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Describe what this pull request does, including technical details, screenshots,

## Changelog New Features
+ Cool new feature. - your_name_here
* extra info
* Extra info.

## Changelog Improvements
+ Improved cool feature. - your_name_here
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ object SkillAPI {
ChatUtils.chat("§bSkill Custom Goal Level")
val map = storage?.filter { it.value.customGoalLevel != 0 } ?: return
if (map.isEmpty()) {
ChatUtils.chat("§cYou haven't set any custom goals yet!")
ChatUtils.userError("You haven't set any custom goals yet!")
}
map.forEach { (skill, data) ->
ChatUtils.chat("§e${skill.displayName}: §b${data.customGoalLevel}")
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.inAnyIsland
import at.hannibal2.skyhanni.utils.StringUtils
import at.hannibal2.skyhanni.utils.chat.Text
import java.lang.invoke.LambdaMetafactory
import java.lang.invoke.MethodHandles
Expand Down Expand Up @@ -91,8 +92,7 @@ class EventHandler<T : SkyHanniEvent> private constructor(val name: String, priv
errors++
if (errors <= 3) {
val errorName = throwable::class.simpleName ?: "error"
var aOrAn = "a"
if (errorName[0] in "aeiou") aOrAn = "an"
val aOrAn = StringUtils.optionalAn(errorName)
val message = "Caught $aOrAn $errorName in ${listener.name} at $name: ${throwable.message}"
ErrorManager.logErrorWithData(throwable, message, ignoreErrorCache = onError != null)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.google.gson.JsonPrimitive
object ConfigUpdaterMigrator {

val logger = LorenzLogger("ConfigMigration")
const val CONFIG_VERSION = 60
const val CONFIG_VERSION = 61
fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? {
if (chain.isEmpty()) return this
if (this !is JsonObject) return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ChromaConfig {
public boolean chromaPreview = false;

@Expose
@ConfigOption(name = "Enabled", desc = "Toggle SkyHanni's chroma. §e(Disables Patcher's Optimized Font Renderer while enabled)")
@ConfigOption(name = "Enabled", desc = "Toggle SkyHanni's chroma.")
@ConfigEditorBoolean
@FeatureToggle
public Property<Boolean> enabled = Property.of(false);
Expand Down Expand Up @@ -80,7 +80,7 @@ public String toString() {
public Runnable resetSettings = ChromaManager::resetChromaSettings;

@Expose
@ConfigOption(name = "Everything Chroma", desc = "Render §4§l§oALL §r§7text in chroma. §e(Some enchants may appear white with SBA enchant parsing)")
@ConfigOption(name = "Everything Chroma", desc = "Render §4§l§oALL §r§7text in chroma. §e(Disables Patcher's Optimized Font Renderer while enabled)")
@ConfigEditorBoolean
public boolean allChroma = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ public class TimerConfig {

@Expose
@ConfigLink(owner = TimerConfig.class, field = "enabled")
// TODO rename to position
public Position pos = new Position(-200, 40, false, true);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.GOLD_ESSENCE;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.HARD_STONE;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.JADE;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.MITHRIL_POWDER;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.ROBOTRON;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.RUBY;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.SAPPHIRE;
Expand Down Expand Up @@ -56,7 +55,6 @@ public class PowderTrackerConfig {
public Property<List<PowderDisplayEntry>> textFormat = Property.of(new ArrayList<>(Arrays.asList(
TOTAL_CHESTS,
DOUBLE_POWDER,
MITHRIL_POWDER,
GEMSTONE_POWDER,
SPACER_1,
DIAMOND_ESSENCE,
Expand All @@ -78,7 +76,6 @@ public class PowderTrackerConfig {
public enum PowderDisplayEntry implements HasLegacyId {
TOTAL_CHESTS("§d852 Total chests Picked §7(950/h)", 2),
DOUBLE_POWDER("§bx2 Powder: §aActive!", 3),
MITHRIL_POWDER("§b250,420 §aMithril Powder §7(350,000/h)", 4),
GEMSTONE_POWDER("§b250,420 §dGemstone Powder §7(350,000/h)", 5),
SPACER_1("", 6),
DIAMOND_ESSENCE("§b129 §bDiamond Essence §7(600/h)", 7),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ public class GunthersRaceConfig {
@ConfigOption(name = "Monochrome Color", desc = "Set a boring monochrome color for the guide waypoints.")
@ConfigEditorColour
public Property<String> monochromeColor = Property.of("0:60:0:0:255");

@Expose
@ConfigOption(name = "Hide Other Players", desc = "Hide other players while in the race.")
@ConfigEditorBoolean
@FeatureToggle
public boolean hidePlayers = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RepoManager(private val configLocation: File) {
private var latestRepoCommit: String? = null
val repoLocation: File = File(configLocation, "repo")
private var error = false
private var lastRepoUpdate = SimpleTimeMark.farPast()
private var lastRepoUpdate = SimpleTimeMark.now()

companion object {

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ 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.ChatUtils
import at.hannibal2.skyhanni.utils.StringUtils
import at.hannibal2.skyhanni.utils.chat.Text
import at.hannibal2.skyhanni.utils.system.PlatformUtils
import net.minecraftforge.common.MinecraftForge
Expand Down Expand Up @@ -57,8 +58,7 @@ abstract class LorenzEvent : Event() {
if (printError && errors <= visibleErrors) {
val callerName = listener.toString().split(" ")[1].split("@")[0].split(".").last()
val errorName = throwable::class.simpleName ?: "error"
var aOrAn = "a"
if (errorName[0] in "aeiou") aOrAn = "an"
val aOrAn = StringUtils.optionalAn(errorName)
val message = "Caught $aOrAn $errorName in $callerName at $eventName: ${throwable.message}"
ErrorManager.logErrorWithData(throwable, message, ignoreErrorCache = ignoreErrorCache)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ object WikiManager {
}
if (message == ("/wikithis")) {
val itemInHand = InventoryUtils.getItemInHand() ?: run {
ChatUtils.chat("§cYou must be holding an item to use this command!")
ChatUtils.userError("You must be holding an item to use this command!")
return
}
wikiTheItem(itemInHand, config.autoOpenWiki)
Expand Down Expand Up @@ -79,7 +79,7 @@ object WikiManager {

fun otherWikiCommands(args: Array<String>, useFandom: Boolean, wikithis: Boolean = false) {
if (wikithis && !LorenzUtils.inSkyBlock) {
ChatUtils.chat("§cYou must be in SkyBlock to do this!")
ChatUtils.userError("You must be in SkyBlock to do this!")
return
}

Expand All @@ -88,7 +88,7 @@ object WikiManager {

if (wikithis) {
val itemInHand = InventoryUtils.getItemInHand() ?: run {
ChatUtils.chat("§cYou must be holding an item to use this command!")
ChatUtils.userError("You must be holding an item to use this command!")
return
}
wikiTheItem(itemInHand, false, useFandom = useFandom)
Expand All @@ -102,8 +102,10 @@ object WikiManager {
}

fun sendWikiMessage(
search: String = "", displaySearch: String = search,
autoOpen: Boolean = config.autoOpenWiki, useFandom: Boolean = config.useFandom
search: String = "",
displaySearch: String = search,
autoOpen: Boolean = config.autoOpenWiki,
useFandom: Boolean = config.useFandom,
) {
val wiki = if (useFandom) "SkyBlock Fandom Wiki" else "Official SkyBlock Wiki"
val urlPrefix = if (useFandom) FANDOM_URL_PREFIX else OFFICIAL_URL_PREFIX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ object TrophyFishMessages {
}

private fun sendTitle(displayName: String, displayRarity: String?, amount: Int) {
val text = "$displayName\n$displayRarity $amount!"
val text = "$displayName $displayRarity §8$amount§c!"
LorenzUtils.sendTitle(text, 3.seconds, 2.8, 7f)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RegexUtils.matchFirst
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderable
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.TabListData
import at.hannibal2.skyhanni.utils.TimeUtils
import at.hannibal2.skyhanni.utils.TimeUtils.format
import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration
Expand All @@ -36,10 +38,10 @@ object GardenVisitorTimer {

private val timePattern by RepoPattern.pattern(
"garden.visitor.timer.time.new",
" Next Visitor: §r(?<info>.*)"
" Next Visitor: §r(?<info>.*)",
)

private var display = ""
private var display: Renderable? = null
private var lastMillis = 0.seconds
private var sixthVisitorArrivalTime = SimpleTimeMark.farPast()
private var visitorJustArrived = false
Expand All @@ -65,7 +67,7 @@ object GardenVisitorTimer {

@SubscribeEvent
fun onProfileJoin(event: ProfileJoinEvent) {
display = ""
display = null
lastMillis = 0.seconds
sixthVisitorArrivalTime = SimpleTimeMark.farPast()
visitorJustArrived = false
Expand All @@ -84,7 +86,7 @@ object GardenVisitorTimer {
TabListData.getTabList().matchFirst(timePattern) {
val timeInfo = group("info").removeColor()
if (timeInfo == "Not Unlocked!") {
display = "§cVisitors not unlocked!"
display = Renderable.string("§cVisitors not unlocked!")
return
}
if (timeInfo == "Queue Full!") {
Expand All @@ -97,7 +99,7 @@ object GardenVisitorTimer {
millis = TimeUtils.getDuration(timeInfo)
}
} ?: run {
display = "§cVisitor time info not in tab list"
display = createDisplayText("§cVisitor time info not in tab list")
return
}

Expand Down Expand Up @@ -140,7 +142,7 @@ object GardenVisitorTimer {
if (lastMillis == Duration.INFINITE) {
ErrorManager.logErrorStateWithData(
"Found Visitor Timer bug, reset value", "lastMillis was infinite",
"lastMillis" to lastMillis
"lastMillis" to lastMillis,
)
lastMillis = 0.seconds
}
Expand Down Expand Up @@ -168,14 +170,20 @@ object GardenVisitorTimer {
"Next in §$formatColor$formatDuration$extraSpeed"
}
val visitorLabel = if (visitorsAmount == 1) "visitor" else "visitors"
display = "§b$visitorsAmount $visitorLabel §7($next§7)"
display = createDisplayText("§b$visitorsAmount $visitorLabel §7($next§7)")
}

private fun createDisplayText(text: String) = Renderable.clickAndHover(
text,
listOf("§eClick to teleport to the barn!"),
onClick = { HypixelCommands.teleportToPlot("barn") },
)

@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
if (!isEnabled()) return

config.pos.renderString(display, posLabel = "Garden Visitor Timer")
config.pos.renderRenderable(display, posLabel = "Garden Visitor Timer")
}

@SubscribeEvent
Expand Down
Loading

0 comments on commit 70e913f

Please sign in to comment.