summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src/com/earth2me/essentials
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-07-19 10:34:02 +0200
committersnowleo <schneeleo@gmail.com>2011-07-19 10:34:02 +0200
commit9e89425dab4f499a435a2146ac1995c587de32ee (patch)
treec836133e98994572a0282c0c906c9ead6c4e50ca /EssentialsProtect/src/com/earth2me/essentials
parente3be177ed484c87300f899f92cba97e94fcfac40 (diff)
downloadEssentials-9e89425dab4f499a435a2146ac1995c587de32ee.tar
Essentials-9e89425dab4f499a435a2146ac1995c587de32ee.tar.gz
Essentials-9e89425dab4f499a435a2146ac1995c587de32ee.tar.lz
Essentials-9e89425dab4f499a435a2146ac1995c587de32ee.tar.xz
Essentials-9e89425dab4f499a435a2146ac1995c587de32ee.zip
Close database connections on plugin deactivation
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java12
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/data/IProtectedBlock.java1
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockJDBC.java5
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMemory.java5
4 files changed, 22 insertions, 1 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
index 216a37564..ed02291cf 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
@@ -12,7 +12,9 @@ import java.beans.PropertyVetoException;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
+import java.util.logging.Filter;
import java.util.logging.Level;
+import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -59,7 +61,7 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect
pm.registerEvent(Type.LIGHTNING_STRIKE, weatherListener, Priority.Highest, this);
pm.registerEvent(Type.THUNDER_CHANGE, weatherListener, Priority.Highest, this);
pm.registerEvent(Type.WEATHER_CHANGE, weatherListener, Priority.Highest, this);
-
+
reloadConfig();
ess.addReloadListener(this);
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
@@ -96,6 +98,10 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect
public void reloadConfig()
{
+ if (storage != null)
+ {
+ storage.onPluginDeactivation();
+ }
for (ProtectConfig protectConfig : ProtectConfig.values())
{
if (protectConfig.isList())
@@ -166,6 +172,10 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect
public void onDisable()
{
+ if (storage != null)
+ {
+ storage.onPluginDeactivation();
+ }
}
public IEssentials getEssentials()
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/IProtectedBlock.java b/EssentialsProtect/src/com/earth2me/essentials/protect/data/IProtectedBlock.java
index 6580ce7f8..271f1c464 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/IProtectedBlock.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/data/IProtectedBlock.java
@@ -11,4 +11,5 @@ public interface IProtectedBlock {
public boolean isProtected(Block block, String playerName);
public List<String> getOwners(Block block);
public int unprotectBlock(Block block);
+ public void onPluginDeactivation();
}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockJDBC.java b/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockJDBC.java
index e6b3c7592..e24a71b80 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockJDBC.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockJDBC.java
@@ -418,4 +418,9 @@ public abstract class ProtectedBlockJDBC implements IProtectedBlock
}
}
}
+
+ public void onPluginDeactivation()
+ {
+ cpds.close();
+ }
}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMemory.java b/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMemory.java
index 2fd32b026..1348b6bc8 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMemory.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMemory.java
@@ -245,4 +245,9 @@ public class ProtectedBlockMemory implements IProtectedBlock
}
return id;
}
+
+ public void onPluginDeactivation()
+ {
+ storage.onPluginDeactivation();
+ }
}