Refactoring code part 1 to prep for adding a bunch of unit tests

This commit is contained in:
nossr50
2021-04-08 10:39:07 -07:00
parent 0636f578dd
commit 5080d86e44
115 changed files with 993 additions and 970 deletions

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.runnables.backups;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.mcMMO;
import org.bukkit.scheduler.BukkitRunnable;
@ -48,11 +47,11 @@ public class CleanBackupsTask extends BukkitRunnable {
int weekOfYear = cal.get(Calendar.WEEK_OF_YEAR);
int year = cal.get(Calendar.YEAR);
if (isPast24Hours(date) && Config.getInstance().getKeepLast24Hours()) {
if (isPast24Hours(date) && mcMMO.p.getGeneralConfig().getKeepLast24Hours()) {
// Keep all files from the last 24 hours
continue;
}
else if (isLastWeek(date) && !savedDays.contains(dayOfWeek) && Config.getInstance().getKeepDailyLastWeek()) {
else if (isLastWeek(date) && !savedDays.contains(dayOfWeek) && mcMMO.p.getGeneralConfig().getKeepDailyLastWeek()) {
// Keep daily backups of the past week
savedDays.add(dayOfWeek);
continue;
@ -60,7 +59,7 @@ public class CleanBackupsTask extends BukkitRunnable {
else {
List<Integer> savedWeeks = savedYearsWeeks.computeIfAbsent(year, k -> new ArrayList<>());
if (!savedWeeks.contains(weekOfYear) && Config.getInstance().getKeepWeeklyPastMonth()) {
if (!savedWeeks.contains(weekOfYear) && mcMMO.p.getGeneralConfig().getKeepWeeklyPastMonth()) {
// Keep one backup of each week
savedWeeks.add(weekOfYear);
continue;