Fixed key storage access in KeyStorage.java

Fix the retrieval and saving of keys by updating the path format used in config.getInt and config.set methods.
This commit is contained in:
Teriuihi 2024-10-04 21:35:43 +02:00
parent 08370abf77
commit ff05856494

View File

@ -54,7 +54,7 @@ public class KeyStorage extends AbstractConfig {
continue; continue;
} }
for (UUID uuid : uuids) { for (UUID uuid : uuids) {
int keys = config.getInt(prefix, String.format("%s.%s", crate, uuid.toString()), 0); int keys = config.getInt(prefix + crate + ".", uuid.toString(), 0);
count.put(uuid, keys); count.put(uuid, keys);
} }
KEYS.put(crate, count); KEYS.put(crate, count);
@ -65,7 +65,7 @@ public class KeyStorage extends AbstractConfig {
config.logger.info("Saving KeyStorage"); config.logger.info("Saving KeyStorage");
KEYS.keySet() KEYS.keySet()
.forEach(crate -> KEYS.get(crate) .forEach(crate -> KEYS.get(crate)
.forEach((uuid, keys) -> config.set(prefix + crate, uuid.toString(), keys))); .forEach((uuid, keys) -> config.set(prefix + crate + ".", uuid.toString(), keys)));
} }
} }
} }