Move all scheduler initialization to BukkitCommandManager #394

The create Locale task is happening DURING object construction so initializing the scheduler in the
PaperCommandManager initialization step is too late due to the bukkit/paper modules extending.
This should fix the issues
This commit is contained in:
chickeneer
2023-06-26 18:11:01 -05:00
parent 6a259126a5
commit b50215e2fa
2 changed files with 6 additions and 6 deletions
@@ -93,7 +93,12 @@ public class BukkitCommandManager extends CommandManager<
public BukkitCommandManager(Plugin plugin) { public BukkitCommandManager(Plugin plugin) {
this.plugin = plugin; this.plugin = plugin;
try {
this.scheduler = new ACFPaperScheduler(Bukkit.getAsyncScheduler());
} catch (NoSuchMethodError e) {
// Ignored to use Bukkit Scheduler
this.scheduler = new ACFBukkitScheduler(); this.scheduler = new ACFBukkitScheduler();
}
String prefix = this.plugin.getDescription().getPrefix(); String prefix = this.plugin.getDescription().getPrefix();
this.logger = Logger.getLogger(prefix != null ? prefix : this.plugin.getName()); this.logger = Logger.getLogger(prefix != null ? prefix : this.plugin.getName());
@@ -45,11 +45,6 @@ public class PaperCommandManager extends BukkitCommandManager {
} catch (ClassNotFoundException ignored) { } catch (ClassNotFoundException ignored) {
// Ignored // Ignored
} }
try {
this.scheduler = new ACFPaperScheduler(Bukkit.getAsyncScheduler());
} catch (NoSuchMethodError e) {
// Ignored - BukkitCommandManager initializes the BukkitScheduler
}
} }
@Override @Override