From 60043c0c70e4ea456f82aba4e4833ede80fa1caf Mon Sep 17 00:00:00 2001 From: ev chang Date: Sat, 22 Jun 2024 09:34:19 +0700 Subject: [PATCH] allow decimals in phrase delay --- src/main/java/org/polyfrost/hytils/config/HytilsConfig.java | 4 ++-- .../hytils/handlers/chat/modules/triggers/AutoGG.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java index a1499dd..8f61bd0 100644 --- a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java +++ b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java @@ -176,7 +176,7 @@ public class HytilsConfig extends Config { category = "Chat", subcategory = "Automatic", min = 0, max = 5 ) - public static int autoGGFirstPhraseDelay = 1; + public static float autoGGFirstPhraseDelay = 1; @Dropdown( name = "Auto GG Second Message", @@ -192,7 +192,7 @@ public class HytilsConfig extends Config { category = "Chat", subcategory = "Automatic", min = 0, max = 5 ) - public static int autoGGSecondPhraseDelay = 1; + public static float autoGGSecondPhraseDelay = 1; @Switch( name = "Auto GL", diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java index 6e7c510..a4aa9ed 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java @@ -46,9 +46,9 @@ private static String getGGMessageTwo() { public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()); if (!hasGameEnded(message)) return; - Multithreading.schedule(() -> UChat.say("/ac " + getGGMessageOne()), HytilsConfig.autoGGFirstPhraseDelay, TimeUnit.SECONDS); + Multithreading.schedule(() -> UChat.say("/ac " + getGGMessageOne()), (long) (HytilsConfig.autoGGFirstPhraseDelay * 1000), TimeUnit.MILLISECONDS); if (HytilsConfig.autoGGSecondMessage) - Multithreading.schedule(() -> UChat.say("/ac " + getGGMessageTwo()), HytilsConfig.autoGGSecondPhraseDelay + HytilsConfig.autoGGFirstPhraseDelay, TimeUnit.SECONDS); + Multithreading.schedule(() -> UChat.say("/ac " + getGGMessageTwo()), (long) ((HytilsConfig.autoGGSecondPhraseDelay + HytilsConfig.autoGGFirstPhraseDelay) * 1000), TimeUnit.MILLISECONDS); } private boolean hasGameEnded(String message) {