diff --git a/src/main/java/com/matt/forgehax/mods/ChatBot.java b/src/main/java/com/matt/forgehax/mods/ChatBot.java index 17d3816e3..d121434b8 100644 --- a/src/main/java/com/matt/forgehax/mods/ChatBot.java +++ b/src/main/java/com/matt/forgehax/mods/ChatBot.java @@ -33,7 +33,7 @@ @RegisterMod public class ChatBot extends ToggleMod { - public final Options spams = + private final Options spams = getCommandStub() .builders() .newOptionsBuilder() @@ -43,7 +43,7 @@ public class ChatBot extends ToggleMod { .supplier(Sets::newConcurrentHashSet) .build(); - public final Setting max_input_length = + private final Setting max_input_length = getCommandStub() .builders() .newSettingBuilder() @@ -54,10 +54,28 @@ public class ChatBot extends ToggleMod { .max(256) .build(); + private final Setting resetSequentialIndex = + getCommandStub() + .builders() + .newSettingBuilder() + .name("reset-sequential") + .description("start spam list anew in sequential mode") + .defaultTo(false) + .build(); + public ChatBot() { super(Category.MISC, "ChatBot", false, "Spam chat"); } + @Override + protected void onDisabled() { + if (resetSequentialIndex.get()) { + for (SpamEntry e : spams) { + e.reset(); + } + } + } + @Override protected void onLoad() { spams @@ -103,6 +121,7 @@ protected void onLoad() { if (data.hasOption("trigger")) entry.setTrigger(data.getOptionAsString("trigger")); if (data.hasOption("enabled")) entry.setEnabled(SafeConverter.toBoolean(data.getOptionAsString("enabled"))); + if (!entry.isEnabled() && resetSequentialIndex.get()) entry.reset(); if (data.hasOption("delay")) entry.setDelay(SafeConverter.toLong(data.getOptionAsString("delay")));