Skip to content

Commit

Permalink
Release
Browse files Browse the repository at this point in the history
  • Loading branch information
PokeMichele authored Nov 27, 2022
1 parent dcfea36 commit 00cae3e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@

description: removes all log files

## Usage
This is how the "config.yml" file appears at first

settings:
enable-auto-remover: true
time-between-log-removing-in-minutes: 10

The Auto-Remover is enabled by default and the default time is set to 10 minutes.
If you want you change the time or you can completely disable the Auto-Remover.

## Build
This plugin has been built using the following dependencies:
- [Apache Commons-IO](https://commons.apache.org/proper/commons-io/ "Apache Commons-IO"), distributed under [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0.txt "Apache 2.0 License")
- [Quartz](http://www.quartz-scheduler.org/ "Quartz"), distributed under [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0.txt "Apache 2.0 License")
This plugin has been built using the following dependencies:
- [Apache Commons-IO](https://commons.apache.org/proper/commons-io/ "Apache Commons-IO"), distributed under [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0.txt "Apache 2.0 License")
- [Quartz](http://www.quartz-scheduler.org/ "Quartz"), distributed under [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0.txt "Apache 2.0 License")

[![Anurag’s github stats](https://github-readme-stats.vercel.app/api?username=PokeMichele)](https://github.com/PokeMichele)
[![Anurag’s github stats](https://github-readme-stats.vercel.app/api?username=PokeMichele)](https://github.com/PokeMichele)
18 changes: 11 additions & 7 deletions src/main/java/me/pokemichele/logdel8/LogDel8.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,28 @@ public void onEnable() {
getCommand("logdel").setExecutor(new LogDelCommand());


//crea cartella del config.yml
//Load config.yml
saveDefaultConfig();

//Setting permissions to the file (+rwx)
LogDir.setReadable(true); //read
LogDir.setWritable(true); //write
LogDir.setExecutable(true); //execute

try {
enableAutoRemover();
} catch (SchedulerException e) {
throw new RuntimeException(e);
if (plugin.getConfig().getBoolean("settings.enable-auto-remover") == true) {
try {
enableAutoRemover();
} catch (SchedulerException e) {
throw new RuntimeException(e);
}
} else {
return;
}

}



//AutoRemover
public static void enableAutoRemover( ) throws SchedulerException {
//delete Logs
//wait 10 minutes
Expand All @@ -67,7 +71,7 @@ public static void enableAutoRemover( ) throws SchedulerException {

SimpleTrigger trigger = newTrigger().withIdentity("trigger1")
.startNow()
.withSchedule(simpleSchedule().withIntervalInMinutes(10).repeatForever())
.withSchedule(simpleSchedule().withIntervalInMinutes(plugin.getConfig().getInt("settings.time-between-log-removing-in-minutes")).repeatForever())
.build();
scheduler.scheduleJob(job, trigger);
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
settings:
time-between-log-removing-in-ms: 600000 # the default time is 600000ms (10 minutes)
enable-auto-remover: true
time-between-log-removing-in-minutes: 10

0 comments on commit 00cae3e

Please sign in to comment.