Skip to content

Commit

Permalink
4.3.19
Browse files Browse the repository at this point in the history
Remove unbinded uuids
More verbose on cloud sync
  • Loading branch information
Emibergo02 committed Oct 15, 2024
1 parent cbc5643 commit 8f2cf09
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>dev.unnm3d</groupId>
<artifactId>RedisEconomy</artifactId>
<version>4.3.18</version>
<version>4.3.19</version>
<packaging>jar</packaging>

<name>RedisEconomy</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
nameUUIDs = currenciesManager.removeNamePattern(target, !onlyNameUUID);
successMsg = plugin.langs().purgeUserSuccess.replace("%player%", target);
}
if (nameUUIDs.size() == 0) {
if (nameUUIDs.isEmpty()) {
plugin.langs().send(sender, plugin.langs().playerNotFound);
return true;
}
plugin.langs().send(sender, successMsg);


return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ public HashMap<String, UUID> removeNamePattern(String namePattern, boolean reset
*/
public HashMap<String, UUID> resetBalanceNamePattern(String namePattern, Currency currencyReset) {
HashMap<String, UUID> removed = new HashMap<>();
currencyReset.getOrderedAccounts(Integer.MAX_VALUE).thenAccept(accounts -> {
for (ScoredValue<String> account : accounts) {
UUID uuid = UUID.fromString(account.getValue());
if (!nameUniqueIds.containsValue(uuid)) {
currencyReset.setPlayerBalance(uuid, null, 0.0);
}
}
});

for (Map.Entry<String, UUID> entry : nameUniqueIds.entrySet()) {
if (entry.getKey().matches(namePattern)) {
removed.put(entry.getKey(), entry.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ private void handleException(@NotNull UUID uuid, @Nullable String playerName, do
if (plugin.settings().debugUpdateCache) {
plugin.getLogger().warning("Player accounts are desynchronized. try: " + tries);
if (e != null)
plugin.getLogger().warning(e.getMessage());
e.printStackTrace();
}
updateAccountCloudCache(uuid, playerName, balance, tries + 1);
return;
Expand Down

0 comments on commit 8f2cf09

Please sign in to comment.