summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java84
1 files changed, 67 insertions, 17 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
index 5c3e3eab7..72000eeba 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
@@ -1,7 +1,9 @@
package com.earth2me.essentials.protect;
import com.earth2me.essentials.protect.data.IProtectedBlock;
+import java.util.logging.Filter;
import java.util.logging.Level;
+import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -12,6 +14,7 @@ import org.bukkit.plugin.java.JavaPlugin;
public class EssentialsProtect extends JavaPlugin implements IProtect
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
+ private static com.mchange.v2.log.MLogger C3P0logger;
//private final transient Map<ProtectConfig, Boolean> settingsBoolean = new EnumMap<ProtectConfig, Boolean>(ProtectConfig.class);
//private final transient Map<ProtectConfig, String> settingsString = new EnumMap<ProtectConfig, String>(ProtectConfig.class);
//private final transient Map<ProtectConfig, List<Integer>> settingsList = new EnumMap<ProtectConfig, List<Integer>>(ProtectConfig.class);
@@ -20,6 +23,18 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
private transient ProtectHolder settings = null;
@Override
+ public void onLoad()
+ {
+ C3P0logger = com.mchange.v2.log.MLog.getLogger(com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.class);
+ C3P0logger.setFilter(new Filter()
+ {
+ public boolean isLoggable(LogRecord lr)
+ {
+ return lr.getLevel() != Level.INFO;
+ }
+ });
+ }
+
public void onEnable()
{
final PluginManager pm = this.getServer().getPluginManager();
@@ -56,10 +71,13 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
LOGGER.log(Level.SEVERE, "Essentials not installed or failed to load. Essenials Protect is in emergency mode now.");
}
- /*
- * @Override public boolean checkProtectionItems(final ProtectConfig list, final int id) { final List<Integer>
- * itemList = settingsList.get(list); return itemList != null && !itemList.isEmpty() && itemList.contains(id); }
- */
+ /*@Override
+ public boolean checkProtectionItems(final ProtectConfig list, final int id)
+ {
+ final List<Integer> itemList = settingsList.get(list);
+ return itemList != null && !itemList.isEmpty() && itemList.contains(id);
+ }*/
+
@Override
public IProtectedBlock getStorage()
{
@@ -76,20 +94,52 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
{
return ess;
}
+
+ /*public Map<ProtectConfig, Boolean> getSettingsBoolean()
+ {
+ return settingsBoolean;
+ }
+
+ public Map<ProtectConfig, String> getSettingsString()
+ {
+ return settingsString;
+ }
+
+ public Map<ProtectConfig, List<Integer>> getSettingsList()
+ {
+ return settingsList;
+ }
+
+ @Override
+ public boolean getSettingBool(final ProtectConfig protectConfig)
+ {
+ final Boolean bool = settingsBoolean.get(protectConfig);
+ return bool == null ? protectConfig.getDefaultValueBoolean() : bool;
+ }
+
+ @Override
+ public String getSettingString(final ProtectConfig protectConfig)
+ {
+ final String str = settingsString.get(protectConfig);
+ return str == null ? protectConfig.getDefaultValueString() : str;
+ }*/
+
+ public void onDisable()
+ {
+ if (storage != null)
+ {
+ storage.onPluginDeactivation();
+ }
+ // Sleep for a second to allow the database to close.
+ try
+ {
+ Thread.sleep(1000);
+ }
+ catch (InterruptedException ex)
+ {
+ }
+ }
- /*
- * public Map<ProtectConfig, Boolean> getSettingsBoolean() { return settingsBoolean; }
- *
- * public Map<ProtectConfig, String> getSettingsString() { return settingsString; }
- *
- * public Map<ProtectConfig, List<Integer>> getSettingsList() { return settingsList; }
- *
- * @Override public boolean getSettingBool(final ProtectConfig protectConfig) { final Boolean bool =
- * settingsBoolean.get(protectConfig); return bool == null ? protectConfig.getDefaultValueBoolean() : bool; }
- *
- * @Override public String getSettingString(final ProtectConfig protectConfig) { final String str =
- * settingsString.get(protectConfig); return str == null ? protectConfig.getDefaultValueString() : str; }
- */
public ProtectHolder getSettings()
{
return settings;