From 240c681c451304bd251d16e52783004fb145347c Mon Sep 17 00:00:00 2001 From: rfresh2 <89827146+rfresh2@users.noreply.github.com> Date: Sun, 6 Oct 2024 17:12:27 -0700 Subject: [PATCH] update replay command to allow configuring threshold --- .../zenith/command/impl/ReplayCommand.java | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/zenith/command/impl/ReplayCommand.java b/src/main/java/com/zenith/command/impl/ReplayCommand.java index b840b214..74db818b 100644 --- a/src/main/java/com/zenith/command/impl/ReplayCommand.java +++ b/src/main/java/com/zenith/command/impl/ReplayCommand.java @@ -43,7 +43,8 @@ public CommandUsage commandUsage() { "stop", "discordUpload on/off", "maxRecordingTime ", - "autoRecordMode " + "autoRecord mode ", + "autoRecord health " ) ); } @@ -89,23 +90,31 @@ public LiteralArgumentBuilder register() { .title("Max Recording Time Set"); return 1; }))) - .then(literal("autoRecordMode").then(argument("mode", string()).executes(c -> { - var modeStr = getString(c, "mode").toLowerCase(); - var foundMode = Arrays.stream(AutoRecordMode.values()) - .filter(mode -> mode.getName().toLowerCase().equals(modeStr)) - .findFirst(); - if (foundMode.isEmpty()) { - c.getSource().getEmbed() - .title("Invalid Mode") - .description("Available Modes: " + Arrays.toString(AutoRecordMode.values())); - return 1; - } else { - CONFIG.client.extra.replayMod.autoRecordMode = foundMode.get(); - c.getSource().getEmbed() - .title("Auto Record Mode Set"); - } - return 1; - }))); + .then(literal("autoRecord") + .then(literal("mode").then(argument("mode", string()).executes(c -> { + var modeStr = getString(c, "mode").toLowerCase(); + var foundMode = Arrays.stream(AutoRecordMode.values()) + .filter(mode -> mode.getName().toLowerCase().equals(modeStr)) + .findFirst(); + if (foundMode.isEmpty()) { + c.getSource().getEmbed() + .title("Invalid Mode") + .description("Available Modes: " + Arrays.toString(AutoRecordMode.values())); + return 1; + } else { + MODULE.get(ReplayMod.class).disable(); + CONFIG.client.extra.replayMod.autoRecordMode = foundMode.get(); + c.getSource().getEmbed() + .title("Auto Record Mode Set"); + } + return 1; + }))) + .then(literal("health").then(argument("health", integer(0, 20)).executes(c -> { + CONFIG.client.extra.replayMod.replayRecordingHealthThreshold = getInteger(c, "health"); + c.getSource().getEmbed() + .title("Auto Record Health Set"); + return 1; + })))); } @Override