From 9dbe30aaa74504c6d6e79510a4d951d7c44a307f Mon Sep 17 00:00:00 2001 From: Paul Reilly Date: Thu, 16 Mar 2023 13:19:37 -0500 Subject: [PATCH] i can't think but this may be right --- .../src/main/java/me/totalfreedom/discord/Bot.java | 9 +-------- .../main/java/me/totalfreedom/discord/TFD4J.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/discord/src/main/java/me/totalfreedom/discord/Bot.java b/discord/src/main/java/me/totalfreedom/discord/Bot.java index 542b8a8f..891e24a5 100644 --- a/discord/src/main/java/me/totalfreedom/discord/Bot.java +++ b/discord/src/main/java/me/totalfreedom/discord/Bot.java @@ -8,6 +8,7 @@ import me.totalfreedom.discord.command.HelpCommand; import me.totalfreedom.discord.command.ListCommand; import me.totalfreedom.discord.command.TPSCommand; import me.totalfreedom.discord.handling.CommandHandler; +import me.totalfreedom.discord.react.ReactiveBukkitScheduler; import me.totalfreedom.discord.util.SnowflakeEntry; import me.totalfreedom.discord.util.TFM_Bridge; import me.totalfreedom.totalfreedommod.config.ConfigEntry; @@ -24,8 +25,6 @@ public class Bot private final GatewayDiscordClient client; private final TFM_Bridge tfm; private final HashMap LINK_CODES = new HashMap<>(); - private Boolean enabled = false; - public Bot() { //Creates the gateway client and connects to the gateway @@ -51,12 +50,6 @@ public class Bot .getDiscriminator(); } - - private String poolIdentifier() - { - return "TFD4J"; - } - public TFM_Bridge getTFM() { return tfm; diff --git a/discord/src/main/java/me/totalfreedom/discord/TFD4J.java b/discord/src/main/java/me/totalfreedom/discord/TFD4J.java index e152000c..129688ea 100644 --- a/discord/src/main/java/me/totalfreedom/discord/TFD4J.java +++ b/discord/src/main/java/me/totalfreedom/discord/TFD4J.java @@ -8,21 +8,22 @@ import me.totalfreedom.discord.handling.CommandHandler; import me.totalfreedom.discord.listener.AdminChatListener; import me.totalfreedom.discord.listener.BukkitNative; import me.totalfreedom.discord.listener.MinecraftListener; +import me.totalfreedom.discord.react.ReactiveBukkitScheduler; import me.totalfreedom.totalfreedommod.api.Context; import me.totalfreedom.totalfreedommod.api.TFD4JCommons; import org.bukkit.plugin.java.JavaPlugin; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class TFD4J extends JavaPlugin { - private final Logger slf4j = getSLF4JLogger(); + private final Logger slf4j = this.getSLF4JLogger(); private Bot bot; private MinecraftListener mc; private AdminChatListener ac; private TFD4JCommons tfd4jcommons; private BukkitNative bn; private CommandHandler ch; + private ReactiveBukkitScheduler rbs; @Override public void onEnable() @@ -34,6 +35,8 @@ public class TFD4J extends JavaPlugin this.bot = new Bot(); bot.initialize(); + this.rbs = new ReactiveBukkitScheduler(this); + slf4j().info("Bot successfully initialized! Registering the Bukkit Native listener..."); this.bn = new BukkitNative(this); @@ -52,6 +55,7 @@ public class TFD4J extends JavaPlugin this.ch.registerCommand(new TPSCommand()); this.getBot().getClient().on(ChatInputInteractionEvent.class, ch::handle) + .subscribeOn(getReactiveBukkitScheduler()) .subscribe(); slf4j().info("Commands successfully registered! Providing context to TFM..."); @@ -98,4 +102,9 @@ public class TFD4J extends JavaPlugin { return ac; } + + public ReactiveBukkitScheduler getReactiveBukkitScheduler() + { + return rbs; + } }