Skip to content

Commit

Permalink
Merge branch 'refs/heads/beta' into moulconfig-update
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
  • Loading branch information
catgirlseraid committed Oct 19, 2024
2 parents 808b022 + 13ed9b5 commit a8df6b2
Show file tree
Hide file tree
Showing 263 changed files with 3,055 additions and 2,478 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/process_detekt_sarif.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ read -r -d '' jq_command <<'EOF'
",title=" + (.ruleId) +
",col=" + (.l.region.startColumn|tostring) +
",endColumn=" + (.l.region.endColumn|tostring) +
"::" + (.message.text)
"::" + (.message)
)
EOF

Expand Down
34 changes: 18 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,30 @@ jobs:
with:
name: "Test Results"
path: versions/1.8.9/build/reports/tests/test/
#detekt:
# name: Run detekt
# runs-on: ubuntu-latest
detekt:
name: Run detekt
runs-on: ubuntu-latest

# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - uses: ./.github/actions/setup-normal-workspace
# # detektMain is a LOT slower than detekt, but it does type analysis
# - name: Run detekt main (w/typing analysis)
# run: |
# ./gradlew detektMain --stacktrace
# - name: Annotate detekt failures
# if: ${{ !cancelled() }}
# run: |
# chmod +x .github/scripts/process_detekt_sarif.sh
# ./.github/scripts/process_detekt_sarif.sh versions/1.8.9/build/reports/detekt/main.sarif
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ./.github/actions/setup-normal-workspace
# detektMain is a LOT slower than detekt, but it does type analysis
- name: Run detekt main (w/typing analysis)
run: |
./gradlew detektMain --stacktrace
- name: Annotate detekt failures
if: ${{ !cancelled() }}
run: |
chmod +x .github/scripts/process_detekt_sarif.sh
./.github/scripts/process_detekt_sarif.sh versions/1.8.9/build/reports/detekt/main.sarif

preprocess:
runs-on: ubuntu-latest
name: "Build multi version"
env:
SKIP_DETEKT: "true"
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: "PR Changelog Verification"

on:
pull_request_target:
types: [ opened, edited ]
types: [ opened, edited, ready_for_review ]

jobs:
verify-changelog:
if: github.event.pull_request.state == 'open' && '511310721' == github.repository_id
if: github.event.pull_request.state == 'open' && '511310721' == github.repository_id && github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ detekt {

tasks.withType<Detekt>().configureEach {
onlyIf {
false // TODO: Remove onlyIf when we're ready to enforce
System.getenv("SKIP_DETEKT") != "true"
}

reports {
Expand Down
27 changes: 2 additions & 25 deletions detekt/baseline.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/api/ReforgeAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ object ReforgeAPI {
return Reforge(
name = it.reforgeName,
type = LorenzUtils.enumValueOf<ReforgeType>(type.first),
stats = it.reforgeStats ?: emptyMap(),
stats = it.reforgeStats.orEmpty(),
reforgeStone = it.internalName,
specialItems = type.second.takeIf { it.isNotEmpty() },
extraProperty = it.reforgeAbility,
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatDouble
import at.hannibal2.skyhanni.utils.NumberUtil.formatLong
import at.hannibal2.skyhanni.utils.NumberUtil.formatLongOrUserError
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.TabListData
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
Expand Down Expand Up @@ -437,7 +437,6 @@ object SkillAPI {
val neededXp = levelingMap.filter { it.key < level }.values.sum().toLong()
ChatUtils.chat("You need §b${neededXp.addSeparators()} §eXP to be level §b${level.toDouble()}")
} else {
val base = levelingMap.values.sum().toLong()
val neededXP = xpRequiredForLevel(level.toDouble())
ChatUtils.chat("You need §b${neededXP.addSeparators()} §eXP to be level §b${level.toDouble()}")
}
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 = 62
const val CONFIG_VERSION = 63
fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? {
if (chain.isEmpty()) return this
if (this !is JsonObject) return null
Expand Down Expand Up @@ -83,7 +83,7 @@ object ConfigUpdaterMigrator {
if (newParentElement !is JsonObject) {
logger.log(
"Catastrophic: element at path $old could not be relocated to $new, " +
"since another element already inhabits that path"
"since another element already inhabits that path"
)
return
}
Expand Down Expand Up @@ -128,13 +128,11 @@ object ConfigUpdaterMigrator {
?.flatMap { player ->
player.value.asJsonObject["profiles"]?.asJsonObject?.entrySet()?.map {
"storage.players.${player.key}.profiles.${it.key}"
} ?: listOf()
}
?: listOf()
}.orEmpty()
}.orEmpty()
),
"#player" to (
storage?.get("players")?.asJsonObject?.entrySet()?.map { "storage.players.${it.key}" }
?: listOf()
storage?.get("players")?.asJsonObject?.entrySet()?.map { "storage.players.${it.key}" }.orEmpty()
),
)
val migration = ConfigFixEvent(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package at.hannibal2.skyhanni.config.commands

import at.hannibal2.skyhanni.api.event.SkyHanniEvent
import at.hannibal2.skyhanni.config.commands.Commands.commands
import at.hannibal2.skyhanni.config.commands.Commands.commandList
import net.minecraftforge.client.ClientCommandHandler

object CommandRegistrationEvent : SkyHanniEvent() {
fun register(name: String, block: CommandBuilder.() -> Unit) {
val info = CommandBuilder(name).apply(block)
if (commands.any { it.name == name }) {
if (commandList.any { it.name == name }) {
error("The command '$name is already registered!'")
}
ClientCommandHandler.instance.registerCommand(info.toSimpleCommand())
commands.add(info)
commandList.add(info)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ import at.hannibal2.skyhanni.utils.chat.ChatClickActionManager
import at.hannibal2.skyhanni.utils.repopatterns.RepoPatternGui

@SkyHanniModule
@Suppress("LargeClass", "LongMethod")
object Commands {

val commands = mutableListOf<CommandBuilder>()
val commandList = mutableListOf<CommandBuilder>()

@HandleEvent
fun onCommandRegistration(event: CommandRegistrationEvent) {
Expand Down Expand Up @@ -298,6 +299,7 @@ object Commands {
event.register("shcolors") {
description = "Prints a list of all Minecraft color & formatting codes in chat."
category = CommandCategory.USERS_ACTIVE
@Suppress("AvoidBritishSpelling")
aliases = listOf("shcolor", "shcolours", "shcolour")
callback { ColorFormattingHelper.printColorCodeList() }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.config.core.elements

import net.minecraft.client.gui.Gui

@Suppress("EmptyFunctionBlock", "UnusedParameter")
abstract class GuiElement : Gui() {
abstract fun render(x: Int, y: Int)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package at.hannibal2.skyhanni.config.features.gui.customscoreboard;

import at.hannibal2.skyhanni.features.gui.customscoreboard.ChunkedStat;
import at.hannibal2.skyhanni.features.gui.customscoreboard.ChunkedStatsLine;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableList;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider;
Expand All @@ -17,7 +17,7 @@ public class ChunkedStatsConfig {
desc = "Select the stats you want to display chunked on the scoreboard."
)
@ConfigEditorDraggableList
public List<ChunkedStat> chunkedStats = new ArrayList<>(ChunkedStat.getEntries());
public List<ChunkedStatsLine> chunkedStats = new ArrayList<>(ChunkedStatsLine.getEntries());

@Expose
@ConfigOption(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.config.core.config.Position;
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardElement;
import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard;
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardConfigElement;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.Accordion;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
Expand All @@ -28,17 +29,14 @@ public class CustomScoreboardConfig {
@Expose
@ConfigOption(
name = "Appearance",
desc = "Drag text to change the appearance of the advanced scoreboard." // supporting both custom & advanced search
desc = "Drag text to change the appearance of the advanced scoreboard."
)
@ConfigEditorDraggableList()
public List<ScoreboardElement> scoreboardEntries = new ArrayList<>(ScoreboardElement.defaultOption);
@ConfigEditorDraggableList
public Property<List<ScoreboardConfigElement>> scoreboardEntries = Property.of(new ArrayList<>(ScoreboardConfigElement.defaultOptions));

@ConfigOption(name = "Reset Appearance", desc = "Reset the appearance of the advanced scoreboard.")
@ConfigEditorButton(buttonText = "Reset")
public Runnable reset = () -> {
scoreboardEntries.clear();
scoreboardEntries.addAll(ScoreboardElement.defaultOption);
};
public Runnable reset = CustomScoreboard::resetAppearance;

@Expose
@ConfigOption(name = "Display Options", desc = "")
Expand All @@ -56,7 +54,11 @@ public class CustomScoreboardConfig {
public InformationFilteringConfig informationFiltering = new InformationFilteringConfig();

@Expose
@ConfigOption(name = "Unknown Lines warning", desc = "Give a chat warning when unknown lines are found in the scoreboard.")
@ConfigOption(
name = "Unknown Lines warning",
desc = "Give a chat warning when unknown lines are found in the scoreboard." +
"\n§cReporting these in the Discord Server are very important, so we can know what lines are missing."
)
@ConfigEditorBoolean
public boolean unknownLinesWarning = true;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.config.features.gui.customscoreboard;

import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.utils.RenderUtils;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.Accordion;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
Expand Down Expand Up @@ -51,7 +52,6 @@ public class DisplayConfig {
@Accordion
public TitleAndFooterConfig titleAndFooter = new TitleAndFooterConfig();


@Expose
@ConfigOption(name = "Hide Vanilla Scoreboard", desc = "Hide the vanilla scoreboard.\n" +
"§cMods that add their own scoreboard will not be affected by this setting!")
Expand Down Expand Up @@ -145,8 +145,16 @@ public String toString() {
public int lineSpacing = 10;

@Expose
@ConfigOption(name = "Cache Scoreboard on Island Switch",
desc = "Will stop the Scoreboard from updating while switching islands.\nRemoves the shaking when loading data.")
@ConfigOption(name = "Text Alignment", desc = "Will align the text to the left, center or right, while not overriding certain lines, like title or footer.")
@ConfigEditorDropdown
public RenderUtils.HorizontalAlignment textAlignment = RenderUtils.HorizontalAlignment.LEFT;

@Expose
@ConfigOption(
name = "Cache Scoreboard on Island Switch",
desc = "Will stop the Scoreboard from updating while switching islands.\n" +
"Removes the shaking when loading data."
)
@ConfigEditorBoolean
public boolean cacheScoreboardOnIslandSwitch = false;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package at.hannibal2.skyhanni.config.features.gui.customscoreboard;

import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvent;
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardConfigEventElement;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorButton;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableList;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
import io.github.notenoughupdates.moulconfig.observer.Property;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -18,13 +19,15 @@ public class EventsConfig {
desc = "Drag your list to select the priority of each event."
)
@ConfigEditorDraggableList()
public List<ScoreboardEvent> eventEntries = new ArrayList<>(ScoreboardEvent.defaultOption);
public Property<List<ScoreboardConfigEventElement>> eventEntries = Property.of(new ArrayList<>(ScoreboardConfigEventElement.defaultOption));

@ConfigOption(name = "Reset Events Priority", desc = "Reset the priority of all events.")
@ConfigEditorButton(buttonText = "Reset")
// TODO move into kotlin
public Runnable reset = () -> {
eventEntries.clear();
eventEntries.addAll(ScoreboardEvent.defaultOption);
eventEntries.get().clear();
eventEntries.get().addAll(ScoreboardConfigEventElement.defaultOption);
eventEntries.notifyObservers();
};

@Expose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class PartyConfig {
@ConfigOption(name = "Max Party List", desc = "Max number of party members to show in the party list (you are not included).")
@ConfigEditorSlider(
minValue = 1,
maxValue = 25, // why do I even set it so high
maxValue = 25,
minStep = 1
)
public Property<Integer> maxPartyList = Property.of(4);
Expand All @@ -21,4 +21,9 @@ public class PartyConfig {
"If disabled, it will only show in Dungeon Hub, Crimson Isle & Kuudra.")
@ConfigEditorBoolean
public boolean showPartyEverywhere = false;

@Expose
@ConfigOption(name = "Show Party Leader", desc = "Show the party leader in the party list.")
@ConfigEditorBoolean
public boolean showPartyLeader = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorText;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
import io.github.notenoughupdates.moulconfig.observer.Property;

public class TitleAndFooterConfig {
@Expose
@ConfigOption(name = "Title and Footer Alignment", desc = "Align the title and footer in the scoreboard.")
@ConfigOption(name = "Title Alignment", desc = "Align the title in the scoreboard.")
@ConfigEditorDropdown
// TODO rename to "horizontalAlignment" or "alignment"
public RenderUtils.HorizontalAlignment alignTitleAndFooter = RenderUtils.HorizontalAlignment.CENTER;
public RenderUtils.HorizontalAlignment alignTitle = RenderUtils.HorizontalAlignment.CENTER;

@Expose
@ConfigOption(name = "Custom Title", desc = "What should be displayed as the title of the scoreboard." +
"\nUse & for colors." +
"\nUse && for colors." +
"\nUse \"\\n\" for new line.")
@ConfigEditorText
public Property<String> customTitle = Property.of("&6&lSKYBLOCK");
public String customTitle = "&&6&&lSKYBLOCK";

@Expose
@ConfigOption(name = "Use Custom Title", desc = "Use a custom title instead of the default Hypixel title.")
Expand All @@ -32,10 +30,22 @@ public class TitleAndFooterConfig {
@ConfigEditorBoolean
public boolean useCustomTitleOutsideSkyBlock = false;

@Expose
@ConfigOption(name = "Footer Alignment", desc = "Align the footer in the scoreboard.")
@ConfigEditorDropdown
public RenderUtils.HorizontalAlignment alignFooter = RenderUtils.HorizontalAlignment.LEFT;

@Expose
@ConfigOption(name = "Custom Footer", desc = "What should be displayed as the footer of the scoreboard." +
"\nUse & for colors." +
"\nUse && for colors." +
"\nUse \"\\n\" for new line.")
@ConfigEditorText
public String customFooter = "&&ewww.hypixel.net";

@Expose
@ConfigOption(name = "Custom Alpha Footer", desc = "What should be displayed as the footer of the scoreboard when on the Alpha Server." +
"\nUse && for colors." +
"\nUse \"\\n\" for new line.")
@ConfigEditorText
public Property<String> customFooter = Property.of("&ewww.hypixel.net");
public String customAlphaFooter = "&&ealpha.hypixel.net";
}
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object BossbarData {
private var bossbar: String? = null
private var previousServerBossbar = ""

fun getBossbar() = bossbar ?: ""
fun getBossbar() = bossbar.orEmpty()

@SubscribeEvent
fun onWorldChange(event: LorenzWorldChangeEvent) {
Expand Down
Loading

0 comments on commit a8df6b2

Please sign in to comment.