From 00cae3e3b04e3af16e15bf9ee38b8855671a4abe Mon Sep 17 00:00:00 2001 From: Michele <50552288+PokeMichele@users.noreply.github.com> Date: Sun, 27 Nov 2022 15:57:50 +0100 Subject: [PATCH] Release --- README.md | 18 ++++++++++++++---- .../java/me/pokemichele/logdel8/LogDel8.java | 18 +++++++++++------- src/main/resources/config.yml | 3 ++- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5989b6b..06bf7fc 100644 --- a/README.md +++ b/README.md @@ -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) \ No newline at end of file diff --git a/src/main/java/me/pokemichele/logdel8/LogDel8.java b/src/main/java/me/pokemichele/logdel8/LogDel8.java index 531bf49..b9e3ba3 100644 --- a/src/main/java/me/pokemichele/logdel8/LogDel8.java +++ b/src/main/java/me/pokemichele/logdel8/LogDel8.java @@ -37,7 +37,7 @@ public void onEnable() { getCommand("logdel").setExecutor(new LogDelCommand()); - //crea cartella del config.yml + //Load config.yml saveDefaultConfig(); //Setting permissions to the file (+rwx) @@ -45,16 +45,20 @@ public void onEnable() { 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 @@ -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); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 780327a..006b87d 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,2 +1,3 @@ settings: - time-between-log-removing-in-ms: 600000 # the default time is 600000ms (10 minutes) \ No newline at end of file + enable-auto-remover: true + time-between-log-removing-in-minutes: 10 \ No newline at end of file