This commit is contained in:
Gabriele C 2015-10-12 18:16:56 +02:00
parent 9e6db7b9f8
commit 92777cd383
3 changed files with 11 additions and 21 deletions

View File

@ -104,20 +104,16 @@ public class DataManager {
for (String name : cleared) {
try {
org.bukkit.OfflinePlayer player = getOfflinePlayer(name);
File playerFile = null;
if (player == null) {
continue;
}
try {
playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat");
} catch(Exception ignore) {
}
if (playerFile.exists()) {
File playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat");
playerFile.delete();
i++;
} else {
playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getName() + ".dat");
} catch(Exception ignore) {
File playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getName() + ".dat");
if (playerFile.exists()) {
playerFile.delete();
i++;
@ -134,22 +130,15 @@ public class DataManager {
int i = 0;
for (String name : cleared) {
try {
File playerFile = null;
try {
playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + plugin.getServer().getOfflinePlayer(name).getUniqueId() + ".yml");
} catch(Exception ignore) {
}
File playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + plugin.getServer().getOfflinePlayer(name).getUniqueId() + ".yml");
playerFile.delete();
i++;
} catch (Exception e) {
File playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + name + ".yml");
if (playerFile.exists()) {
playerFile.delete();
i++;
} else {
playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + name + ".yml");
if (playerFile.exists()) {
playerFile.delete();
i++;
}
}
} catch (Exception e) {
}
}
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " EssentialsFiles");

View File

@ -255,6 +255,7 @@ public class AdminCommand implements CommandExecutor {
}
}
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@SuppressWarnings("deprecation")
@Override
public void run() {
try {

View File

@ -9,6 +9,8 @@ import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import com.zaxxer.hikari.pool.PoolInitializationException;
@ -18,8 +20,6 @@ import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.settings.Settings;
import org.bukkit.Bukkit;
public class MySQL implements DataSource {