From abddb265be001ebfda6bbcdeb6846a440dcc1300 Mon Sep 17 00:00:00 2001 From: Luck Date: Sat, 18 Feb 2017 08:50:06 +0000 Subject: [PATCH] ensure all bukkit permissions are registered on startup --- .../lucko/luckperms/bukkit/LPBukkitPlugin.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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 5c416f422..03349cdde 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java @@ -158,14 +158,17 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { defaultsProvider.refresh(); childPermissionProvider.setup(); - getServer().getScheduler().runTaskAsynchronously(this, () -> { - for (Map.Entry e : defaultsProvider.getOpDefaults().entrySet()) { - permissionVault.offer(e.getKey()); - } + Set perms = new HashSet<>(); + getServer().getPluginManager().getPermissions().forEach(p -> { + perms.add(p.getName()); + perms.addAll(p.getChildren().keySet()); + }); - for (Map.Entry e : defaultsProvider.getNonOpDefaults().entrySet()) { - permissionVault.offer(e.getKey()); - } + getServer().getScheduler().runTaskAsynchronously(this, () -> { + defaultsProvider.getOpDefaults().entrySet().stream().map(Map.Entry::getKey).forEach(e -> permissionVault.offer(e)); + defaultsProvider.getNonOpDefaults().entrySet().stream().map(Map.Entry::getKey).forEach(e -> permissionVault.offer(e)); + + perms.forEach(p -> permissionVault.offer(p)); ImmutableMap, ImmutableMap> permissions = childPermissionProvider.getPermissions(); for (Map.Entry, ImmutableMap> e : permissions.entrySet()) {