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();
childPermissionProvider.setup();
getServer().getScheduler().runTaskAsynchronously(this, () -> {
for (Map.Entry<String, Boolean> e : defaultsProvider.getOpDefaults().entrySet()) {
permissionVault.offer(e.getKey());
}
Set<String> perms = new HashSet<>();
getServer().getPluginManager().getPermissions().forEach(p -> {
perms.add(p.getName());
perms.addAll(p.getChildren().keySet());
});
for (Map.Entry<String, Boolean> 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<Map.Entry<String, Boolean>, ImmutableMap<String, Boolean>> permissions = childPermissionProvider.getPermissions();
for (Map.Entry<Map.Entry<String, Boolean>, ImmutableMap<String, Boolean>> e : permissions.entrySet()) {