Fixed autopurge with UUIDS

This commit is contained in:
Gabriele C 2015-07-29 14:49:14 +02:00
parent 79759bf139
commit a06f3de35a
3 changed files with 21 additions and 7 deletions

View File

@ -250,11 +250,11 @@ public class AuthMe extends JavaPlugin {
ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!");
} }
if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled){ if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled) {
ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!");
} }
if (Settings.reloadSupport) if (Settings.reloadSupport) {
try { try {
int playersOnline = 0; int playersOnline = 0;
try { try {
@ -279,9 +279,9 @@ public class AuthMe extends JavaPlugin {
} }
} catch (Exception ex) { } catch (Exception ex) {
} }
}
if (Settings.usePurge) autoPurge();
autoPurge();
// Download GeoIp.dat file // Download GeoIp.dat file
downloadGeoIp(); downloadGeoIp();
@ -545,13 +545,13 @@ public class AuthMe extends JavaPlugin {
return; return;
ConsoleLogger.info("AutoPurging the Database: " + cleared.size() + " accounts removed!"); ConsoleLogger.info("AutoPurging the Database: " + cleared.size() + " accounts removed!");
if (Settings.purgeEssentialsFile && this.ess != null) if (Settings.purgeEssentialsFile && this.ess != null)
dataManager.purgeEssentials(cleared); dataManager.purgeEssentials(cleared); // name to UUID convertion needed with latest versions
if (Settings.purgePlayerDat) if (Settings.purgePlayerDat)
dataManager.purgeDat(cleared); dataManager.purgeDat(cleared); // name to UUID convertion needed with latest versions of MC
if (Settings.purgeLimitedCreative) if (Settings.purgeLimitedCreative)
dataManager.purgeLimitedCreative(cleared); dataManager.purgeLimitedCreative(cleared);
if (Settings.purgeAntiXray) if (Settings.purgeAntiXray)
dataManager.purgeAntiXray(cleared); dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or names... (Actually it purges only names!)
if (Settings.purgePermissions) if (Settings.purgePermissions)
dataManager.purgePermissions(cleared, permission); dataManager.purgePermissions(cleared, permission);
} }

View File

@ -109,6 +109,12 @@ public class DataManager {
if (playerFile.exists()) { if (playerFile.exists()) {
playerFile.delete(); playerFile.delete();
i++; i++;
} else {
playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat");
if (playerFile.exists()) {
playerFile.delete();
i++;
}
} }
} catch (Exception e) { } catch (Exception e) {
} }
@ -116,6 +122,7 @@ public class DataManager {
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " .dat Files"); ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " .dat Files");
} }
@SuppressWarnings("deprecation")
public void purgeEssentials(List<String> cleared) { public void purgeEssentials(List<String> cleared) {
int i = 0; int i = 0;
for (String name : cleared) { for (String name : cleared) {
@ -124,6 +131,12 @@ public class DataManager {
if (playerFile.exists()) { if (playerFile.exists()) {
playerFile.delete(); playerFile.delete();
i++; i++;
} else {
playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + Bukkit.getOfflinePlayer(name).getUniqueId() + ".yml");
if (playerFile.exists()) {
playerFile.delete();
i++;
}
} }
} catch (Exception e) { } catch (Exception e) {
} }

View File

@ -13,6 +13,7 @@ public interface Module {
public enum ModuleType { public enum ModuleType {
MANAGER, MANAGER,
MYSQL, MYSQL,
REDIS,
ACTIONS, ACTIONS,
CONVERTERS, CONVERTERS,
EMAILS, EMAILS,