ensure all bukkit permissions are registered on startup

This commit is contained in:
Luck 2017-02-18 08:50:06 +00:00
parent b328fa74a7
commit abddb265be
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -158,14 +158,17 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
defaultsProvider.refresh(); defaultsProvider.refresh();
childPermissionProvider.setup(); childPermissionProvider.setup();
getServer().getScheduler().runTaskAsynchronously(this, () -> { Set<String> perms = new HashSet<>();
for (Map.Entry<String, Boolean> e : defaultsProvider.getOpDefaults().entrySet()) { getServer().getPluginManager().getPermissions().forEach(p -> {
permissionVault.offer(e.getKey()); perms.add(p.getName());
} perms.addAll(p.getChildren().keySet());
});
for (Map.Entry<String, Boolean> e : defaultsProvider.getNonOpDefaults().entrySet()) { getServer().getScheduler().runTaskAsynchronously(this, () -> {
permissionVault.offer(e.getKey()); 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<Map.Entry<String, Boolean>, ImmutableMap<String, Boolean>> permissions = childPermissionProvider.getPermissions(); ImmutableMap<Map.Entry<String, Boolean>, ImmutableMap<String, Boolean>> permissions = childPermissionProvider.getPermissions();
for (Map.Entry<Map.Entry<String, Boolean>, ImmutableMap<String, Boolean>> e : permissions.entrySet()) { for (Map.Entry<Map.Entry<String, Boolean>, ImmutableMap<String, Boolean>> e : permissions.entrySet()) {