Correct enterprise logging values, ignore event life of zero.

This commit is contained in:
h31ix committed 2013-10-12 21:22:42 -04:00
1 parent 34845dd6db
commit a08a558bc2
3 files changed
+18 -17

No files matched your search

@@ -48,9 +48,9 @@ public class Enterprise extends ConfigurationFile {
public void open() { public void open() {
serverName = new ConfigValue<String>("server.name"); serverName = new ConfigValue<String>("server.name");
loggingEnabled = new ConfigValue<Boolean>("logging.enable"); loggingEnabled = new ConfigValue<Boolean>("log.enable");
loggingLife = new ConfigValue<Integer>("logging.life"); loggingLife = new ConfigValue<Integer>("log.life");
loggingInterval = new ConfigValue<Integer>("logging.interval"); loggingInterval = new ConfigValue<Integer>("log.interval");
syncUsers = new ConfigValue<Boolean>("sync.users"); syncUsers = new ConfigValue<Boolean>("sync.users");
@@ -23,7 +23,6 @@ import net.h31ix.anticheat.config.Configuration;
import net.h31ix.anticheat.config.ConfigurationFile; import net.h31ix.anticheat.config.ConfigurationFile;
import net.h31ix.anticheat.config.providers.Events; import net.h31ix.anticheat.config.providers.Events;
import net.h31ix.anticheat.util.Level; import net.h31ix.anticheat.util.Level;
import net.h31ix.anticheat.util.Utilities;
import java.util.*; import java.util.*;
@@ -182,21 +182,23 @@ public class Database {
} }
public void cleanEvents() { public void cleanEvents() {
Bukkit.getScheduler().runTaskAsynchronously(AntiCheat.getPlugin(), new Runnable() { if (eventLife != 0) {
@Override Bukkit.getScheduler().runTaskAsynchronously(AntiCheat.getPlugin(), new Runnable() {
public void run() { @Override
try { public void run() {
PreparedStatement statement = connection.prepareStatement(sqlCleanEvents); try {
statement.setInt(1, eventLife); PreparedStatement statement = connection.prepareStatement(sqlCleanEvents);
statement.setInt(1, eventLife);
statement.executeUpdate(); statement.executeUpdate();
connection.commit(); connection.commit();
AntiCheat.getPlugin().verboseLog("Cleaned " + statement.getUpdateCount() + " old events from the database"); AntiCheat.getPlugin().verboseLog("Cleaned " + statement.getUpdateCount() + " old events from the database");
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
}
} }
} });
}); }
} }
} }