diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java index 3ed3d15b..9eccae3a 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java @@ -76,6 +76,7 @@ import me.lucko.luckperms.common.storage.StorageType; import me.lucko.luckperms.common.storage.backing.file.FileWatcher; import me.lucko.luckperms.common.tasks.CacheHousekeepingTask; import me.lucko.luckperms.common.tasks.ExpireTemporaryTask; +import me.lucko.luckperms.common.tasks.UpdateTask; import me.lucko.luckperms.common.treeview.PermissionVault; import me.lucko.luckperms.common.utils.LoginHelper; import me.lucko.luckperms.common.utils.UuidCache; @@ -273,7 +274,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { // run an update instantly. getLog().info("Performing initial data load..."); - updateTaskBuffer.requestDirectly(); + new UpdateTask(this, true).run(); // register tasks scheduler.asyncRepeating(new ExpireTemporaryTask(this), 60L); diff --git a/bungee/src/main/java/me/lucko/luckperms/bungee/LPBungeePlugin.java b/bungee/src/main/java/me/lucko/luckperms/bungee/LPBungeePlugin.java index bdd6ad61..47eb0a4a 100644 --- a/bungee/src/main/java/me/lucko/luckperms/bungee/LPBungeePlugin.java +++ b/bungee/src/main/java/me/lucko/luckperms/bungee/LPBungeePlugin.java @@ -72,6 +72,7 @@ import me.lucko.luckperms.common.storage.StorageType; import me.lucko.luckperms.common.storage.backing.file.FileWatcher; import me.lucko.luckperms.common.tasks.CacheHousekeepingTask; import me.lucko.luckperms.common.tasks.ExpireTemporaryTask; +import me.lucko.luckperms.common.tasks.UpdateTask; import me.lucko.luckperms.common.treeview.PermissionVault; import me.lucko.luckperms.common.utils.UuidCache; import me.lucko.luckperms.common.verbose.VerboseHandler; @@ -200,7 +201,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin { // run an update instantly. getLog().info("Performing initial data load..."); - updateTaskBuffer.requestDirectly(); + new UpdateTask(this, true).run(); // register tasks scheduler.asyncRepeating(new ExpireTemporaryTask(this), 60L); diff --git a/common/src/main/java/me/lucko/luckperms/common/buffers/UpdateTaskBuffer.java b/common/src/main/java/me/lucko/luckperms/common/buffers/UpdateTaskBuffer.java index e9b6385d..70915b7e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/buffers/UpdateTaskBuffer.java +++ b/common/src/main/java/me/lucko/luckperms/common/buffers/UpdateTaskBuffer.java @@ -38,7 +38,7 @@ public class UpdateTaskBuffer extends BufferedRequest { @Override protected Void perform() { - new UpdateTask(plugin).run(); + new UpdateTask(plugin, false).run(); return null; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/tasks/UpdateTask.java b/common/src/main/java/me/lucko/luckperms/common/tasks/UpdateTask.java index 9951c209..1d6c2b61 100644 --- a/common/src/main/java/me/lucko/luckperms/common/tasks/UpdateTask.java +++ b/common/src/main/java/me/lucko/luckperms/common/tasks/UpdateTask.java @@ -31,10 +31,17 @@ import me.lucko.luckperms.api.event.cause.CreationCause; import me.lucko.luckperms.common.config.ConfigKeys; import me.lucko.luckperms.common.plugin.LuckPermsPlugin; +import java.util.concurrent.CompletableFuture; + @AllArgsConstructor public class UpdateTask implements Runnable { private final LuckPermsPlugin plugin; + /** + * If this task is being called before the server has fully started + */ + private final boolean initialUpdate; + /** * Called ASYNC */ @@ -55,7 +62,10 @@ public class UpdateTask implements Runnable { plugin.getStorage().loadAllTracks().join(); // Refresh all online users. - plugin.getUserManager().updateAllUsers().join(); + CompletableFuture userUpdateFut = plugin.getUserManager().updateAllUsers(); + if (!initialUpdate) { + userUpdateFut.join(); + } plugin.onPostUpdate(); diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongePlugin.java b/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongePlugin.java index a94e86f3..7a1f2f2e 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongePlugin.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongePlugin.java @@ -65,6 +65,7 @@ import me.lucko.luckperms.common.storage.StorageType; import me.lucko.luckperms.common.storage.backing.file.FileWatcher; import me.lucko.luckperms.common.tasks.CacheHousekeepingTask; import me.lucko.luckperms.common.tasks.ExpireTemporaryTask; +import me.lucko.luckperms.common.tasks.UpdateTask; import me.lucko.luckperms.common.treeview.PermissionVault; import me.lucko.luckperms.common.utils.UuidCache; import me.lucko.luckperms.common.verbose.VerboseHandler; @@ -264,7 +265,7 @@ public class LPSpongePlugin implements LuckPermsPlugin { // run an update instantly. getLog().info("Performing initial data load..."); - updateTaskBuffer.requestDirectly(); + new UpdateTask(this, true).run(); // register tasks scheduler.asyncRepeating(new ExpireTemporaryTask(this), 60L);