A system to allow automatic removal of clutter files you dislike.
This commit is contained in:
parent
500e5ba8ec
commit
1bb7d0a1d5
@ -191,6 +191,10 @@ public class MCore extends MPlugin
|
||||
test("1months2ms");
|
||||
*/
|
||||
|
||||
// Delete Files (at once and additionally after all plugins loaded)
|
||||
TaskDeleteFiles.get().run();
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, TaskDeleteFiles.get());
|
||||
|
||||
this.postEnable();
|
||||
}
|
||||
|
||||
@ -232,6 +236,7 @@ public class MCore extends MPlugin
|
||||
{
|
||||
super.onDisable();
|
||||
ExamineThread.get().interrupt();
|
||||
TaskDeleteFiles.get().run();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.massivecraft.mcore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
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 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
|
||||
// -------------------------------------------- //
|
||||
|
28
src/com/massivecraft/mcore/TaskDeleteFiles.java
Normal file
28
src/com/massivecraft/mcore/TaskDeleteFiles.java
Normal 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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user