aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de
diff options
context:
space:
mode:
authorAaron <51387595+AzureAaron@users.noreply.github.com>2024-04-06 04:22:23 -0400
committerAaron <51387595+AzureAaron@users.noreply.github.com>2024-04-26 16:23:20 -0400
commit4581056e0f741e6f253613eb401c2c84652c9e1c (patch)
tree1ed25bc15633a8f63d85fa8d8243e59e79f7ebfe /src/main/java/de
parent371a1ca08095d408b9586bec03c9ebd52cfc59c2 (diff)
downloadSkyblocker-4581056e0f741e6f253613eb401c2c84652c9e1c.tar.gz
Skyblocker-4581056e0f741e6f253613eb401c2c84652c9e1c.tar.bz2
Skyblocker-4581056e0f741e6f253613eb401c2c84652c9e1c.zip
More Pattern Matching
This is not everything.
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/hysky/skyblocker/mixin/MinecraftClientMixin.java11
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/shortcut/ShortcutsConfigListWidget.java12
2 files changed, 12 insertions, 11 deletions
diff --git a/src/main/java/de/hysky/skyblocker/mixin/MinecraftClientMixin.java b/src/main/java/de/hysky/skyblocker/mixin/MinecraftClientMixin.java
index dd671b2e..75a45d7c 100644
--- a/src/main/java/de/hysky/skyblocker/mixin/MinecraftClientMixin.java
+++ b/src/main/java/de/hysky/skyblocker/mixin/MinecraftClientMixin.java
@@ -43,11 +43,12 @@ public abstract class MinecraftClientMixin {
@ModifyVariable(at = @At("HEAD"), method = "setScreen", ordinal = 0, argsOnly = true)
public Screen modifySetScreen(Screen screen) {
if (Utils.isOnSkyblock()) {
- if (screen instanceof DownloadingTerrainScreen) {
- return null;
- } else if (screen instanceof ReconfiguringScreen && this.getNetworkHandler() != null) {
- return new ReconfiguringPlaceholderScreen(this.getNetworkHandler().getConnection());
- }
+ return switch (screen) {
+ case DownloadingTerrainScreen _s -> null;
+ case ReconfiguringScreen _s when this.getNetworkHandler() != null -> new ReconfiguringPlaceholderScreen(this.getNetworkHandler().getConnection());
+
+ default -> screen;
+ };
}
return screen;
}
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/shortcut/ShortcutsConfigListWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/shortcut/ShortcutsConfigListWidget.java
index 0c35eb2a..3960b0d1 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/shortcut/ShortcutsConfigListWidget.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/shortcut/ShortcutsConfigListWidget.java
@@ -52,12 +52,12 @@ public class ShortcutsConfigListWidget extends ElementListWidget<ShortcutsConfig
}
protected Optional<ShortcutCategoryEntry> getCategory() {
- if (getSelectedOrNull() instanceof ShortcutCategoryEntry category) {
- return Optional.of(category);
- } else if (getSelectedOrNull() instanceof ShortcutEntry shortcutEntry) {
- return Optional.of(shortcutEntry.category);
- }
- return Optional.empty();
+ return switch (getSelectedOrNull()) {
+ case ShortcutCategoryEntry category -> Optional.of(category);
+ case ShortcutEntry shortcutEntry -> Optional.of(shortcutEntry.category);
+
+ default -> Optional.empty();
+ };
}
@Override