From c2e3c7fe5eeea767d2ce517a7ef9e4c67a7968e5 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Mon, 10 Jul 2023 16:36:00 +0800 Subject: Refactor queueOpenScreen --- .../java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/main/java/me/xmrvizzy/skyblocker/config') diff --git a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java index 8c7d2f71..c4eeb090 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java @@ -1,6 +1,5 @@ package me.xmrvizzy.skyblocker.config; -import com.mojang.brigadier.Command; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import me.shedaniel.autoconfig.AutoConfig; import me.shedaniel.autoconfig.ConfigData; @@ -518,7 +517,7 @@ public class SkyblockerConfig implements ConfigData { */ public static void init() { AutoConfig.register(SkyblockerConfig.class, GsonConfigSerializer::new); - ClientCommandRegistrationCallback.EVENT.register(((dispatcher, registryAccess) -> dispatcher.register(literal("skyblocker").then(optionsLiteral("config")).then(optionsLiteral("options"))))); + ClientCommandRegistrationCallback.EVENT.register(((dispatcher, registryAccess) -> dispatcher.register(literal(SkyblockerMod.NAMESPACE).then(optionsLiteral("config")).then(optionsLiteral("options"))))); } /** @@ -528,11 +527,8 @@ public class SkyblockerConfig implements ConfigData { * @return the command builder */ private static LiteralArgumentBuilder optionsLiteral(String name) { - return literal(name).executes(context -> { - // Don't immediately open the next screen as it will be closed by ChatScreen right after this command is executed - SkyblockerMod.getInstance().scheduler.queueOpenScreen(AutoConfig.getConfigScreen(SkyblockerConfig.class, null)); - return Command.SINGLE_SUCCESS; - }); + // Don't immediately open the next screen as it will be closed by ChatScreen right after this command is executed + return literal(name).executes(context -> SkyblockerMod.getInstance().scheduler.queueOpenScreen(AutoConfig.getConfigScreen(SkyblockerConfig.class, null))); } public static SkyblockerConfig get() { -- cgit