Optimizie Island settings loader

This commit is contained in:
Fabrizio La Rosa 2020-06-13 06:18:27 +02:00
parent a4e80241b9
commit d2cf9edf09

View File

@ -162,10 +162,10 @@ public class Island {
}
for (IslandRole roleList : IslandRole.getRoles()) {
List<IslandPermission> permissions = new ArrayList<>();
for (BasicPermission permission : skyblock.getPermissionManager().getPermissions()) {
List<BasicPermission> allPermissions = skyblock.getPermissionManager().getPermissions();
List<IslandPermission> permissions = new ArrayList<>(allPermissions.size());
for (BasicPermission permission : allPermissions) {
if (settingsDataConfig == null || settingsDataConfig.getFileConfiguration()
.getString("Settings." + roleList.name() + "." + permission.getName()) == null) {
permissions.add(
@ -187,7 +187,7 @@ public class Island {
configLoad.set("Border.Enable", true);
configLoad.set("Border.Color", WorldBorder.Color.Blue.name());
configLoad.set("Biome.Type", mainConfigLoad.getString("Island.Biome.Default.Type").toUpperCase());
configLoad.set("Weather.Synchronised", mainConfigLoad.getBoolean("Island.Weather.Default.Synchronised"));
configLoad.set("Weather.Synchronised", mainConfigLoad.getBoolean("Island.Weather.Default.Synchronised")); // TODO: Synchronized
configLoad.set("Weather.Time", mainConfigLoad.getInt("Island.Weather.Default.Time"));
configLoad.set("Weather.Weather", mainConfigLoad.getString("Island.Weather.Default.Weather").toUpperCase());
configLoad.set("Ownership.Original", ownerUUID.toString());
@ -198,7 +198,8 @@ public class Island {
for (BasicPermission permission : allPermissions) {
permissions.add(
new IslandPermission(permission, defaultSettingsConfig.getFileConfiguration().getBoolean("Settings." + roleList.name() + "." + permission.getName(), true)));
new IslandPermission(permission, defaultSettingsConfig.getFileConfiguration()
.getBoolean("Settings." + roleList.name() + "." + permission.getName(), true)));
}
islandPermissions.put(roleList, permissions);