A system to allow automatic removal of clutter files you dislike.

This commit is contained in:
Olof Larsson 2014-04-01 12:45:29 +02:00
parent 500e5ba8ec
commit 1bb7d0a1d5
3 changed files with 38 additions and 0 deletions

View File

@ -191,6 +191,10 @@ public class MCore extends MPlugin
test("1months2ms"); test("1months2ms");
*/ */
// Delete Files (at once and additionally after all plugins loaded)
TaskDeleteFiles.get().run();
Bukkit.getScheduler().scheduleSyncDelayedTask(this, TaskDeleteFiles.get());
this.postEnable(); this.postEnable();
} }
@ -232,6 +236,7 @@ public class MCore extends MPlugin
{ {
super.onDisable(); super.onDisable();
ExamineThread.get().interrupt(); ExamineThread.get().interrupt();
TaskDeleteFiles.get().run();
} }
} }

View File

@ -1,5 +1,6 @@
package com.massivecraft.mcore; package com.massivecraft.mcore;
import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -56,6 +57,10 @@ public class MCoreConf extends Entity<MCoreConf>
public Map<String, Integer> getPermissionToTpdelay() { return this.permissionToTpdelay == null ? new LinkedHashMap<String, Integer>() : new LinkedHashMap<String, Integer>(this.permissionToTpdelay); } public Map<String, Integer> getPermissionToTpdelay() { return this.permissionToTpdelay == null ? new LinkedHashMap<String, Integer>() : new LinkedHashMap<String, Integer>(this.permissionToTpdelay); }
public void setPermissionToTpdelay(Map<String, Integer> permissionToTpdelay) { this.permissionToTpdelay = permissionToTpdelay == null ? new LinkedHashMap<String, Integer>() : new LinkedHashMap<String, Integer>(permissionToTpdelay); this.changed(); } public void setPermissionToTpdelay(Map<String, Integer> permissionToTpdelay) { this.permissionToTpdelay = permissionToTpdelay == null ? new LinkedHashMap<String, Integer>() : new LinkedHashMap<String, Integer>(permissionToTpdelay); this.changed(); }
private List<String> deleteFiles = new ArrayList<String>();
public List<String> getDeleteFiles() { return this.deleteFiles == null ? new ArrayList<String>() : new ArrayList<String>(this.deleteFiles); }
public void setDeleteFiles(List<String> deleteFiles) { this.deleteFiles = deleteFiles == null ? new ArrayList<String>() : new ArrayList<String>(deleteFiles); this.changed(); }
// -------------------------------------------- // // -------------------------------------------- //
// HELP ACCESS // HELP ACCESS
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -0,0 +1,28 @@
package com.massivecraft.mcore;
import java.io.File;
public class TaskDeleteFiles implements Runnable
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static TaskDeleteFiles i = new TaskDeleteFiles();
public static TaskDeleteFiles get() { return i; }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void run()
{
for (String deleteFile : MCoreConf.get().getDeleteFiles())
{
File file = new File(deleteFile);
file.delete();
}
}
}