mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-10-31 19:44:03 +01:00
Added a 1 second delay to fix a mysterious bug that didn't allow expansions to load
This commit is contained in:
parent
83261eee49
commit
c9cf609b91
@ -61,6 +61,7 @@ import org.bukkit.event.HandlerList;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.server.PluginDisableEvent;
|
import org.bukkit.event.server.PluginDisableEvent;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@ -336,6 +337,9 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
private void registerAll(@NotNull final CommandSender sender) {
|
private void registerAll(@NotNull final CommandSender sender) {
|
||||||
Msg.info("Placeholder expansion registration initializing...");
|
Msg.info("Placeholder expansion registration initializing...");
|
||||||
|
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
Futures.onMainThread(plugin, findExpansionsOnDisk(), (classes, exception) -> {
|
Futures.onMainThread(plugin, findExpansionsOnDisk(), (classes, exception) -> {
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
Msg.severe("Failed to load class files of expansion.", exception);
|
Msg.severe("Failed to load class files of expansion.", exception);
|
||||||
@ -344,7 +348,7 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
|
|
||||||
final List<PlaceholderExpansion> registered = classes.stream()
|
final List<PlaceholderExpansion> registered = classes.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.map(this::register)
|
.map(LocalExpansionManager.this::register)
|
||||||
.filter(Optional::isPresent)
|
.filter(Optional::isPresent)
|
||||||
.map(Optional::get)
|
.map(Optional::get)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@ -374,6 +378,8 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
Bukkit.getPluginManager().callEvent(new ExpansionsLoadedEvent(registered));
|
Bukkit.getPluginManager().callEvent(new ExpansionsLoadedEvent(registered));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}.runTaskLater(plugin, 20L);
|
||||||
|
}
|
||||||
|
|
||||||
private void unregisterAll() {
|
private void unregisterAll() {
|
||||||
for (final PlaceholderExpansion expansion : Sets.newHashSet(expansions.values())) {
|
for (final PlaceholderExpansion expansion : Sets.newHashSet(expansions.values())) {
|
||||||
|
Loading…
Reference in New Issue
Block a user