From a08a558bc202dd8b6aac55c06dec35ff8af36311 Mon Sep 17 00:00:00 2001 From: h31ix Date: Sat, 12 Oct 2013 21:22:42 -0400 Subject: [PATCH] Correct enterprise logging values, ignore event life of zero. --- .../anticheat/config/files/Enterprise.java | 6 ++-- .../config/holders/yaml/YamlEventsHolder.java | 1 - .../anticheat/util/enterprise/Database.java | 28 ++++++++++--------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/h31ix/anticheat/config/files/Enterprise.java b/src/main/java/net/h31ix/anticheat/config/files/Enterprise.java index 66de632..8b08c1d 100644 --- a/src/main/java/net/h31ix/anticheat/config/files/Enterprise.java +++ b/src/main/java/net/h31ix/anticheat/config/files/Enterprise.java @@ -48,9 +48,9 @@ public class Enterprise extends ConfigurationFile { public void open() { serverName = new ConfigValue("server.name"); - loggingEnabled = new ConfigValue("logging.enable"); - loggingLife = new ConfigValue("logging.life"); - loggingInterval = new ConfigValue("logging.interval"); + loggingEnabled = new ConfigValue("log.enable"); + loggingLife = new ConfigValue("log.life"); + loggingInterval = new ConfigValue("log.interval"); syncUsers = new ConfigValue("sync.users"); diff --git a/src/main/java/net/h31ix/anticheat/config/holders/yaml/YamlEventsHolder.java b/src/main/java/net/h31ix/anticheat/config/holders/yaml/YamlEventsHolder.java index b2ea118..388814f 100644 --- a/src/main/java/net/h31ix/anticheat/config/holders/yaml/YamlEventsHolder.java +++ b/src/main/java/net/h31ix/anticheat/config/holders/yaml/YamlEventsHolder.java @@ -23,7 +23,6 @@ import net.h31ix.anticheat.config.Configuration; import net.h31ix.anticheat.config.ConfigurationFile; import net.h31ix.anticheat.config.providers.Events; import net.h31ix.anticheat.util.Level; -import net.h31ix.anticheat.util.Utilities; import java.util.*; diff --git a/src/main/java/net/h31ix/anticheat/util/enterprise/Database.java b/src/main/java/net/h31ix/anticheat/util/enterprise/Database.java index f0dd4d9..9b5af34 100644 --- a/src/main/java/net/h31ix/anticheat/util/enterprise/Database.java +++ b/src/main/java/net/h31ix/anticheat/util/enterprise/Database.java @@ -182,21 +182,23 @@ public class Database { } public void cleanEvents() { - Bukkit.getScheduler().runTaskAsynchronously(AntiCheat.getPlugin(), new Runnable() { - @Override - public void run() { - try { - PreparedStatement statement = connection.prepareStatement(sqlCleanEvents); - statement.setInt(1, eventLife); + if (eventLife != 0) { + Bukkit.getScheduler().runTaskAsynchronously(AntiCheat.getPlugin(), new Runnable() { + @Override + public void run() { + try { + PreparedStatement statement = connection.prepareStatement(sqlCleanEvents); + statement.setInt(1, eventLife); - statement.executeUpdate(); + statement.executeUpdate(); - connection.commit(); - AntiCheat.getPlugin().verboseLog("Cleaned " + statement.getUpdateCount() + " old events from the database"); - } catch (SQLException e) { - e.printStackTrace(); + connection.commit(); + AntiCheat.getPlugin().verboseLog("Cleaned " + statement.getUpdateCount() + " old events from the database"); + } catch (SQLException e) { + e.printStackTrace(); + } } - } - }); + }); + } } }