mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
ACTUALLY make removing powerless players work for Flatfile. Old users
will only work from here forward - we never tracked login time before for FlatFile.
This commit is contained in:
parent
3f6c07ba6a
commit
7e4188e776
@ -14,10 +14,8 @@ import org.bukkit.Bukkit;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public final class Leaderboard {
|
||||
private static HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
|
||||
@ -320,14 +318,8 @@ public final class Leaderboard {
|
||||
mcMMO.p.getLogger().info("Purging powerless users...");
|
||||
|
||||
int purgedUsers = 0;
|
||||
for (McMMOPlayer player : Users.getPlayers().values()) {
|
||||
String playerName = player.getPlayer().getName();
|
||||
|
||||
if (playerName == null || Bukkit.getOfflinePlayer(playerName).isOnline()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getPlayerRank(playerName)[1] == 0 && removeFlatFileUser(playerName)) {
|
||||
for (PlayerStat stat : powerLevels) {
|
||||
if (stat.statVal == 0 && removeFlatFileUser(stat.name) && !Bukkit.getOfflinePlayer(stat.name).isOnline()) {
|
||||
purgedUsers++;
|
||||
}
|
||||
}
|
||||
@ -359,7 +351,8 @@ public final class Leaderboard {
|
||||
while ((line = in.readLine()) != null) {
|
||||
|
||||
/* Write out the same file but when we get to the player we want to remove, we skip his line. */
|
||||
if (currentTime - (Misc.getLong(line.split(":")[37]) * 1000) <= purgeTime) {
|
||||
String[] splitLine = line.split(":");
|
||||
if (splitLine.length > 37 && currentTime - (Misc.getLong(line.split(":")[37]) * 1000) <= purgeTime) {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user