WorldGuard should now close loggers on disable and reload.

This commit is contained in:
sk89q 2010-11-19 20:34:38 -08:00
parent e543ac733f
commit b7e5828c3f
2 changed files with 15 additions and 0 deletions

View File

@ -90,6 +90,7 @@ public class WorldGuard extends Plugin {
@Override
public void disable() {
try {
listener.disable();
BlacklistEntry.forgetAllPlayers();
} catch (Throwable t) {
}

View File

@ -154,6 +154,11 @@ public class WorldGuardListener extends PluginListener {
// Load the blacklist
try {
// If there was an existing blacklist, close loggers
if (blacklist != null) {
blacklist.getLogger().close();
}
// First load the blacklist data from worldguard-blacklist.txt
Blacklist blacklist = new Blacklist();
blacklist.load(new File("worldguard-blacklist.txt"));
@ -636,4 +641,13 @@ public class WorldGuardListener extends PluginListener {
plugin.toggleEnabled();
}
}
/**
* Call to disable the plugin.
*/
public void disable() {
if (blacklist != null) {
blacklist.getLogger().close();
}
}
}