Skip to content

Commit

Permalink
Thread.sleep(duration) requires Java 19+
Browse files Browse the repository at this point in the history
  • Loading branch information
Smudgge committed Oct 29, 2023
1 parent cf4a95b commit b94c71f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.smuddgge.leaf.commands.types;

import com.github.smuddgge.leaf.MessageManager;
import com.github.smuddgge.leaf.commands.BaseCommandType;
import com.github.smuddgge.leaf.commands.CommandStatus;
import com.github.smuddgge.leaf.commands.CommandSuggestions;
Expand Down Expand Up @@ -131,7 +132,12 @@ public CommandStatus onDiscordRun(ConfigurationSection section, SlashCommandInte

try {

Thread.sleep(Duration.ofSeconds(2));
try {
// Attempt to sleep.
Thread.sleep(2000);
} catch (Exception ignored) {
MessageManager.warn("Unable to Thread.sleep(); for the 'command' command type. This may be due to needing a higher Java Version.");
}

// Respond message.
hook.editOriginal(MessageEditData.fromCreateData(new DiscordBotMessageAdapter(
Expand Down

0 comments on commit b94c71f

Please sign in to comment.