mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-10-06 10:27:26 +02:00
Shutdown logging to file in a clean way if the plugin gets disabled
This commit is contained in:
parent
7390acdd39
commit
467fb90ad1
@ -3,7 +3,7 @@ name: NoCheat
|
|||||||
author: Evenprime
|
author: Evenprime
|
||||||
|
|
||||||
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
||||||
version: 0.8.3a
|
version: 0.8.3b
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
nocheat:
|
nocheat:
|
||||||
|
@ -161,6 +161,10 @@ public class NoCheat extends JavaPlugin {
|
|||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
|
|
||||||
|
if(config != null)
|
||||||
|
config.cleanup();
|
||||||
|
|
||||||
Logger.getLogger("Minecraft").info( "[NoCheat] version [" + pdfFile.getVersion() + "] is disabled.");
|
Logger.getLogger("Minecraft").info( "[NoCheat] version [" + pdfFile.getVersion() + "] is disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,21 @@ public class NoCheatConfiguration {
|
|||||||
plugin.airbuildCheck.setActive(c.getBoolean("active.airbuild", plugin.airbuildCheck.isActive()));
|
plugin.airbuildCheck.setActive(c.getBoolean("active.airbuild", plugin.airbuildCheck.isActive()));
|
||||||
plugin.bedteleportCheck.setActive(c.getBoolean("active.bedteleport", plugin.bedteleportCheck.isActive()));
|
plugin.bedteleportCheck.setActive(c.getBoolean("active.bedteleport", plugin.bedteleportCheck.isActive()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cleanup() {
|
||||||
|
|
||||||
|
if(fh != null) {
|
||||||
|
try {
|
||||||
|
logger.removeHandler(fh);
|
||||||
|
fh.flush();
|
||||||
|
fh.close();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Action[] stringToActions(String string, Action[] def) {
|
private Action[] stringToActions(String string, Action[] def) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user