Skip to content

Commit

Permalink
Fix remove offline uuids command
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCodez committed Feb 3, 2024
1 parent 9b20d17 commit 5e42fdb
Showing 1 changed file with 5 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.bencodez.votingplugin.commands;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -1701,25 +1700,13 @@ public void execute(CommandSender sender, String[] args) {
sendMessage(sender, "&cNot in online mode!");
return;
}
HashMap<UUID, ArrayList<Column>> cols = plugin.getUserManager().getAllKeys();
int amount = 0;
for (Entry<UUID, ArrayList<Column>> entry : cols.entrySet()) {
String playerName = null;
for (Column col : entry.getValue()) {
if (col.getName().equalsIgnoreCase("PlayerName")) {
playerName = col.getValue().getString();
}
}
if (playerName != null) {
plugin.debug(playerName);
if (entry.getKey().toString()
.equals(UUID.nameUUIDFromBytes(
("OfflinePlayer:" + playerName).getBytes(StandardCharsets.UTF_8))
.toString())) {
plugin.getUserManager().removeUUID(entry.getKey());
amount++;
}
for (String uuid : plugin.getUserManager().getAllUUIDs()) {
if (uuid.charAt(14) == '3') {
plugin.getUserManager().removeUUID(UUID.fromString(uuid));
amount++;
}

}
sendMessage(sender, "&cOffline UUIDs purged: " + amount);
}
Expand Down

0 comments on commit 5e42fdb

Please sign in to comment.