Fix Purge Wipe Data

This commit is contained in:
Xephi 2014-01-10 04:42:31 +01:00
parent d926d9ac83
commit 90ae238c15
5 changed files with 19 additions and 17 deletions

View File

@ -24,7 +24,7 @@
</plugin>
</plugins>
</build>
<version>3.2.1-DEV-1</version>
<version>3.2.1-DEV-2</version>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>

View File

@ -7,6 +7,7 @@ import java.io.OutputStream;
import java.net.InetAddress;
import java.net.URL;
import java.net.URLConnection;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -118,7 +119,7 @@ public class AuthMe extends JavaPlugin {
public void onEnable() {
instance = this;
authme = instance;
authmeLogger.setParent(this.getLogger());
citizens = new CitizensCommunicator(this);
@ -147,12 +148,11 @@ public class AuthMe extends JavaPlugin {
this.getLogger().setFilter(new ConsoleFilter());
Bukkit.getLogger().setFilter(new ConsoleFilter());
Logger.getLogger("Minecraft").setFilter(new ConsoleFilter());
Logger.getLogger("AuthMe").setFilter(new ConsoleFilter());
try {
org.apache.logging.log4j.core.Logger coreLogger = (org.apache.logging.log4j.core.Logger) LogManager.getRootLogger();
coreLogger.addFilter(new Log4JFilter());
} catch (Exception e) {
} catch (NoClassDefFoundError e) {}
authmeLogger.setFilter(new ConsoleFilter());
// Set Log4J Filter
org.apache.logging.log4j.core.Logger coreLogger = (org.apache.logging.log4j.core.Logger) LogManager.getRootLogger();
coreLogger.addFilter(new Log4JFilter());
}
//Load MailApi
@ -173,7 +173,7 @@ public class AuthMe extends JavaPlugin {
//Check ChestShop
checkChestShop();
//Check Essentials
checkEssentials();
@ -593,8 +593,9 @@ public class AuthMe extends JavaPlugin {
if (!Settings.usePurge) {
return;
}
long days = Settings.purgeDelay * 86400000;
long until = new Date().getTime() - days;
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, -(Settings.purgeDelay));
long until = calendar.getTimeInMillis();
List<String> cleared = this.database.autoPurgeDatabase(until);
ConsoleLogger.info("AutoPurgeDatabase : " + cleared.size() + " accounts removed.");
if (cleared.isEmpty())
@ -734,7 +735,7 @@ public class AuthMe extends JavaPlugin {
} catch (Exception e) {}
}
}
public String getCountryCode(InetAddress ip) {
try {
if (ls == null)
@ -745,7 +746,7 @@ public class AuthMe extends JavaPlugin {
} catch (Exception e) {}
return null;
}
public void switchAntiBotMod(boolean mode) {
this.antibotMod = mode;
Settings.switchAntiBotMod(mode);

View File

@ -6,6 +6,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
@ -102,8 +103,9 @@ public class AdminCommand implements CommandExecutor {
return true;
}
try {
long days = Long.parseLong(args[1]) * 86400000;
long until = new Date().getTime() - days;
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, -(Integer.parseInt(args[1])));
long until = calendar.getTimeInMillis();
List<String> purged = database.autoPurgeDatabase(until);
sender.sendMessage("Deleted " + purged.size() + " user accounts");
if (Settings.purgeEssentialsFile && plugin.ess != null)

View File

@ -13,7 +13,6 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;

View File

@ -3,7 +3,7 @@ author: Xephi59
website: http://dev.bukkit.org/bukkit-plugins/authme-recoded/
description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the current player.
main: fr.xephi.authme.AuthMe
version: 3.2.1-DEV-1
version: 3.2.1-DEV-2
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag, Essentials, EssentialsSpawn]
commands:
register: