Skip to content

Commit

Permalink
Should've used the argument as input all along
Browse files Browse the repository at this point in the history
  • Loading branch information
legoraft committed Oct 28, 2023
1 parent e036495 commit bb4db01
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main/java/com/survivaltweaks/commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.text.Text;

import static com.mojang.brigadier.arguments.BoolArgumentType.bool;
import static com.mojang.brigadier.arguments.BoolArgumentType.getBool;

public class commands {

Expand All @@ -16,27 +17,27 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher, C
.then(CommandManager.literal("noExpensive")
.then(CommandManager.argument("boolean", bool())
.executes(c -> {
config.NO_EXPENSIVE = !config.NO_EXPENSIVE;
config.NO_EXPENSIVE = getBool(c, "boolean");
applyChanges();
c.getSource().sendMessage(Text.literal("Rule noExpensive is now set to: " + config.NO_EXPENSIVE));
return 1;
})
)
)
.then(CommandManager.literal("endermanGriefing")
.then(CommandManager.literal("noEndermanGriefing")
.then(CommandManager.argument("boolean", bool())
.executes(c -> {
config.NO_ENDERMAN_GRIEF = !config.NO_ENDERMAN_GRIEF;
config.NO_ENDERMAN_GRIEF = getBool(c, "boolean");
applyChanges();
c.getSource().sendMessage(Text.literal("Rule endermanGriefing is now set to: " + !config.NO_ENDERMAN_GRIEF));
c.getSource().sendMessage(Text.literal("Rule noEndermanGriefing is now set to: " + config.NO_ENDERMAN_GRIEF));
return 1;
})
)
)
.then(CommandManager.literal("survivalDebugStick")
.then(CommandManager.argument("boolean", bool())
.executes(c -> {
config.SURVIVAL_DEBUG_STICK = !config.SURVIVAL_DEBUG_STICK;
config.SURVIVAL_DEBUG_STICK = getBool(c, "boolean");
applyChanges();
c.getSource().sendMessage(Text.literal("Rule survivalDebugStick is now set to: " + config.SURVIVAL_DEBUG_STICK));
return 1;
Expand All @@ -46,7 +47,7 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher, C
.then(CommandManager.literal("cheapRename")
.then(CommandManager.argument("boolean", bool())
.executes(c -> {
config.CHEAP_RENAME = !config.CHEAP_RENAME;
config.CHEAP_RENAME = getBool(c, "boolean");
applyChanges();
c.getSource().sendMessage(Text.literal("Rule cheapRename is now set to: " + config.CHEAP_RENAME));
return 1;
Expand All @@ -56,7 +57,7 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher, C
.then(CommandManager.literal("noXpPenalty")
.then(CommandManager.argument("boolean", bool())
.executes(c -> {
config.NO_XP_PENALTY = !config.NO_XP_PENALTY;
config.NO_XP_PENALTY = getBool(c, "boolean");
applyChanges();
c.getSource().sendMessage(Text.literal("Rule noXpPenalty is now set to: " + config.NO_XP_PENALTY));
return 1;
Expand Down

0 comments on commit bb4db01

Please sign in to comment.