mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-17 20:11:21 +02:00
Close database connections on plugin deactivation
This commit is contained in:
@@ -12,7 +12,9 @@ import java.beans.PropertyVetoException;
|
|||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Filter;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.LogRecord;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -96,6 +98,10 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect
|
|||||||
|
|
||||||
public void reloadConfig()
|
public void reloadConfig()
|
||||||
{
|
{
|
||||||
|
if (storage != null)
|
||||||
|
{
|
||||||
|
storage.onPluginDeactivation();
|
||||||
|
}
|
||||||
for (ProtectConfig protectConfig : ProtectConfig.values())
|
for (ProtectConfig protectConfig : ProtectConfig.values())
|
||||||
{
|
{
|
||||||
if (protectConfig.isList())
|
if (protectConfig.isList())
|
||||||
@@ -166,6 +172,10 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect
|
|||||||
|
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
|
if (storage != null)
|
||||||
|
{
|
||||||
|
storage.onPluginDeactivation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEssentials getEssentials()
|
public IEssentials getEssentials()
|
||||||
|
@@ -11,4 +11,5 @@ public interface IProtectedBlock {
|
|||||||
public boolean isProtected(Block block, String playerName);
|
public boolean isProtected(Block block, String playerName);
|
||||||
public List<String> getOwners(Block block);
|
public List<String> getOwners(Block block);
|
||||||
public int unprotectBlock(Block block);
|
public int unprotectBlock(Block block);
|
||||||
|
public void onPluginDeactivation();
|
||||||
}
|
}
|
||||||
|
@@ -418,4 +418,9 @@ public abstract class ProtectedBlockJDBC implements IProtectedBlock
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onPluginDeactivation()
|
||||||
|
{
|
||||||
|
cpds.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -245,4 +245,9 @@ public class ProtectedBlockMemory implements IProtectedBlock
|
|||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onPluginDeactivation()
|
||||||
|
{
|
||||||
|
storage.onPluginDeactivation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user