Skip to content

Commit

Permalink
update replay command to allow configuring threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Oct 7, 2024
1 parent 8a0b199 commit 240c681
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions src/main/java/com/zenith/command/impl/ReplayCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public CommandUsage commandUsage() {
"stop",
"discordUpload on/off",
"maxRecordingTime <minutes>",
"autoRecordMode <off/proxyConnected/playerConnected/health>"
"autoRecord mode <off/proxyConnected/playerConnected/health>",
"autoRecord health <integer>"
)
);
}
Expand Down Expand Up @@ -89,23 +90,31 @@ public LiteralArgumentBuilder<CommandContext> 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
Expand Down

0 comments on commit 240c681

Please sign in to comment.