Skip to content

Commit

Permalink
Don't look up offline players by name
Browse files Browse the repository at this point in the history
  • Loading branch information
nossr50 committed Jun 17, 2023
1 parent e9a0205 commit cc1b511
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -197,7 +197,8 @@ public void purgeOldUsers() {

while ((line = in.readLine()) != null) {
String[] character = line.split(":");
String name = character[USERNAME_INDEX];
String uuidString = character[UUID_INDEX];
UUID uuid = UUID.fromString(uuidString);
long lastPlayed = 0;
boolean rewrite = false;

Expand All @@ -208,15 +209,15 @@ public void purgeOldUsers() {
}

if (lastPlayed == -1) {
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(name);
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(uuid);

if(player.getLastPlayed() != 0) {
lastPlayed = player.getLastPlayed();
rewrite = true;
}
}

if (lastPlayed != -1 && lastPlayed != 0 && currentTime - lastPlayed > purgeTime) {
if (lastPlayed < 1 && (currentTime - lastPlayed > purgeTime)) {
removedPlayers++;
} else {
if (rewrite) {
Expand Down

0 comments on commit cc1b511

Please sign in to comment.