Merge 545f7f0bbdf1e2179d194f831b09ee0a07562f47 into 882b7c59651ed8f3bb64b179691f49eb330b99a1

This commit is contained in:
wxip 2024-03-11 00:51:25 -06:00 committed by GitHub
commit 82641e96bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -61,6 +61,7 @@ import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -352,6 +353,9 @@ public final class LocalExpansionManager implements Listener {
private void registerAll(@NotNull final CommandSender sender) {
Msg.info("Placeholder expansion registration initializing...");
new BukkitRunnable() {
@Override
public void run() {
Futures.onMainThread(plugin, findExpansionsOnDisk(), (classes, exception) -> {
if (exception != null) {
Msg.severe("Failed to load class files of expansion.", exception);
@ -360,7 +364,7 @@ public final class LocalExpansionManager implements Listener {
final List<PlaceholderExpansion> registered = classes.stream()
.filter(Objects::nonNull)
.map(this::register)
.map(LocalExpansionManager.this::register)
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList());
@ -390,6 +394,8 @@ public final class LocalExpansionManager implements Listener {
Bukkit.getPluginManager().callEvent(new ExpansionsLoadedEvent(registered));
});
}
}.runTaskLater(plugin, 1L);
}
private void unregisterAll() {
for (final PlaceholderExpansion expansion : Sets.newHashSet(expansions.values())) {