@@ -115,7 +115,7 @@ public class SimpleClaimSystem extends JavaPlugin {
115115 private SimpleClaimSystem instance ;
116116
117117 /** The version of the plugin */
118- private String Version = "1.12.0.9 " ;
118+ private String Version = "1.12.0.10 " ;
119119
120120 /** Data source for database connections */
121121 private HikariDataSource dataSource ;
@@ -833,25 +833,6 @@ public boolean loadConfig(boolean reload, CommandSender sender) {
833833 claimSettingsInstance .setGroups (groups );
834834 claimSettingsInstance .setGroupsSettings (groupsSettings );
835835
836- // Add player settings
837- ConfigurationSection playersSection = getConfig ().getConfigurationSection ("players" );
838- Map <UUID , Map <String , Double >> playersSettings = new HashMap <>();
839- for (String key : playersSection .getKeys (false )) {
840- Map <String , Double > settings = new HashMap <>();
841- if (getConfig ().isSet ("players." + key + ".max-claims" )) settings .put ("max-claims" , getConfig ().getDouble ("players." + key + ".max-claims" ));
842- if (getConfig ().isSet ("players." + key + ".max-radius-claims" )) settings .put ("max-radius-claims" , getConfig ().getDouble ("players." + key + ".max-radius-claims" ));
843- if (getConfig ().isSet ("players." + key + ".teleportation-delay" )) settings .put ("teleportation-delay" , getConfig ().getDouble ("players." + key + ".teleportation-delay" ));
844- if (getConfig ().isSet ("players." + key + ".claim-cost" )) settings .put ("claim-cost" , getConfig ().getDouble ("players." + key + ".claim-cost" ));
845- if (getConfig ().isSet ("players." + key + ".claim-cost-multiplier" )) settings .put ("claim-cost-multiplier" , getConfig ().getDouble ("players." + key + ".claim-cost-multiplier" ));
846- if (getConfig ().isSet ("players." + key + ".max-chunks-per-claim" )) settings .put ("max-chunks-per-claim" , getConfig ().getDouble ("players." + key + ".max-chunks-per-claim" ));
847- if (getConfig ().isSet ("players." + key + ".claim-distance" )) settings .put ("claim-distance" , getConfig ().getDouble ("players." + key + ".claim-distance" ));
848- if (getConfig ().isSet ("players." + key + ".max-chunks-total" )) settings .put ("max-chunks-total" , getConfig ().getDouble ("players." + key + ".max-chunks-total" ));
849- if (getConfig ().isSet ("players." + key + ".chunk-cost" )) settings .put ("chunk-cost" , getConfig ().getDouble ("players." + key + ".chunk-cost" ));
850- if (getConfig ().isSet ("players." + key + ".chunk-cost-multiplier" )) settings .put ("chunk-cost-multiplier" , getConfig ().getDouble ("players." + key + ".chunk-cost-multiplier" ));
851- if (!settings .isEmpty ()) playersSettings .put (Bukkit .getOfflinePlayer (key ).getUniqueId (), settings );
852- }
853- cPlayerMainInstance .setPlayersConfigSettings (playersSettings );
854-
855836 // Register listener for entering/leaving claims
856837 getServer ().getPluginManager ().registerEvents (new ClaimEventsEnterLeave (this ), this );
857838
@@ -922,6 +903,30 @@ public boolean loadConfig(boolean reload, CommandSender sender) {
922903 // Load players
923904 cPlayerMainInstance .loadPlayers ();
924905
906+ // Add player settings
907+ ConfigurationSection playersSection = getConfig ().getConfigurationSection ("players" );
908+ Map <UUID , Map <String , Double >> playersSettings = new HashMap <>();
909+ for (String key : playersSection .getKeys (false )) {
910+ Map <String , Double > settings = new HashMap <>();
911+ if (getConfig ().isSet ("players." + key + ".max-claims" )) settings .put ("max-claims" , getConfig ().getDouble ("players." + key + ".max-claims" ));
912+ if (getConfig ().isSet ("players." + key + ".max-radius-claims" )) settings .put ("max-radius-claims" , getConfig ().getDouble ("players." + key + ".max-radius-claims" ));
913+ if (getConfig ().isSet ("players." + key + ".teleportation-delay" )) settings .put ("teleportation-delay" , getConfig ().getDouble ("players." + key + ".teleportation-delay" ));
914+ if (getConfig ().isSet ("players." + key + ".claim-cost" )) settings .put ("claim-cost" , getConfig ().getDouble ("players." + key + ".claim-cost" ));
915+ if (getConfig ().isSet ("players." + key + ".claim-cost-multiplier" )) settings .put ("claim-cost-multiplier" , getConfig ().getDouble ("players." + key + ".claim-cost-multiplier" ));
916+ if (getConfig ().isSet ("players." + key + ".max-chunks-per-claim" )) settings .put ("max-chunks-per-claim" , getConfig ().getDouble ("players." + key + ".max-chunks-per-claim" ));
917+ if (getConfig ().isSet ("players." + key + ".claim-distance" )) settings .put ("claim-distance" , getConfig ().getDouble ("players." + key + ".claim-distance" ));
918+ if (getConfig ().isSet ("players." + key + ".max-chunks-total" )) settings .put ("max-chunks-total" , getConfig ().getDouble ("players." + key + ".max-chunks-total" ));
919+ if (getConfig ().isSet ("players." + key + ".chunk-cost" )) settings .put ("chunk-cost" , getConfig ().getDouble ("players." + key + ".chunk-cost" ));
920+ if (getConfig ().isSet ("players." + key + ".chunk-cost-multiplier" )) settings .put ("chunk-cost-multiplier" , getConfig ().getDouble ("players." + key + ".chunk-cost-multiplier" ));
921+ if (!settings .isEmpty ()) {
922+ UUID uuid = cPlayerMainInstance .getPlayerUUID (key );
923+ if (uuid != null ) {
924+ playersSettings .put (uuid , settings );
925+ }
926+ }
927+ }
928+ cPlayerMainInstance .setPlayersConfigSettings (playersSettings );
929+
925930 // Add players setting and active their bossbar (/reload prevention)
926931 if (isFolia ) {
927932 Bukkit .getOnlinePlayers ().forEach (p -> {
@@ -1001,6 +1006,10 @@ public boolean reloadOnlyConfig(CommandSender sender) {
10011006 dossier .mkdirs ();
10021007 }
10031008
1009+ // Add update settings
1010+ claimSettingsInstance .addSetting ("check-for-updates" , getConfig ().getString ("check-for-updates" ));
1011+ claimSettingsInstance .addSetting ("updates-notifications" , getConfig ().getString ("updates-notifications" ));
1012+
10041013 // Check default language file for additions
10051014 checkAndSaveResource ("langs/en_US.yml" );
10061015 updateLangFileWithMissingKeys ("en_US.yml" );
@@ -1473,7 +1482,12 @@ public boolean reloadOnlyConfig(CommandSender sender) {
14731482 if (getConfig ().isSet ("players." + key + ".max-chunks-total" )) settings .put ("max-chunks-total" , getConfig ().getDouble ("players." + key + ".max-chunks-total" ));
14741483 if (getConfig ().isSet ("players." + key + ".chunk-cost" )) settings .put ("chunk-cost" , getConfig ().getDouble ("players." + key + ".chunk-cost" ));
14751484 if (getConfig ().isSet ("players." + key + ".chunk-cost-multiplier" )) settings .put ("chunk-cost-multiplier" , getConfig ().getDouble ("players." + key + ".chunk-cost-multiplier" ));
1476- if (!settings .isEmpty ()) playersSettings .put (Bukkit .getOfflinePlayer (key ).getUniqueId (), settings );
1485+ if (!settings .isEmpty () && cPlayerMainInstance != null ) {
1486+ UUID uuid = cPlayerMainInstance .getPlayerUUID (key );
1487+ if (uuid != null ) {
1488+ playersSettings .put (uuid , settings );
1489+ }
1490+ }
14771491 }
14781492 cPlayerMainInstance .setPlayersConfigSettings (playersSettings );
14791493
0 commit comments