Apply minor changes to PurgeService

- Remove various imports / unused fields
- Make CacheDataSource call source for purging on DB
- Minor: SQLite - place creation of PreparedStatement outside of loop
- Make specific purge actions called from task package-private (clearer from the outside which methods can be called from the outside)
This commit is contained in:
ljacqu
2016-06-16 21:04:12 +02:00
parent fb8baeafd2
commit 2ac89f5938
9 changed files with 30 additions and 57 deletions
@@ -1,12 +1,8 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.process.purge.PurgeService;
import fr.xephi.authme.task.PurgeTask;
import fr.xephi.authme.task.PurgeService;
import fr.xephi.authme.util.BukkitService;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
@@ -30,8 +26,8 @@ public class PurgeBannedPlayersCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
// Get the list of banned players
Set<String> namedBanned = new HashSet<>();
Set<OfflinePlayer> bannedPlayers = bukkitService.getBannedPlayers();
Set<String> namedBanned = new HashSet<>(bannedPlayers.size());
for (OfflinePlayer offlinePlayer : bannedPlayers) {
namedBanned.add(offlinePlayer.getName().toLowerCase());
}
@@ -1,17 +1,13 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.process.purge.PurgeService;
import fr.xephi.authme.task.PurgeTask;
import fr.xephi.authme.task.PurgeService;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import javax.inject.Inject;
import java.util.Calendar;
import java.util.List;
import java.util.Set;
/**
* Command for purging the data of players which have not been since for a given number
@@ -24,9 +20,6 @@ public class PurgeCommand implements ExecutableCommand {
@Inject
private PurgeService purgeService;
@Inject
private AuthMe plugin;
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
// Get the days parameter