Minor - rename LimboPlayer methods + code householding

- Rename *taskId methods to *task to reflect what they handle
- Remove usages of Wrapper where applicable
- Replace some uses of legacy Settings with NewSetting calls
This commit is contained in:
ljacqu
2016-03-06 15:38:08 +01:00
parent 3f4681c5ed
commit 654cebd5a7
21 changed files with 99 additions and 109 deletions
@@ -60,9 +60,9 @@ public class UnregisterAdminCommand implements ExecutableCommand {
BukkitScheduler scheduler = sender.getServer().getScheduler();
if (timeOut != 0) {
BukkitTask id = scheduler.runTaskLater(plugin, new TimeoutTask(plugin, playerNameLowerCase, target), timeOut);
LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setTimeoutTaskId(id);
LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setTimeoutTask(id);
}
LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setMessageTaskId(
LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setMessageTask(
scheduler.runTask(
plugin, new MessageTask(plugin, playerNameLowerCase, MessageKey.REGISTER_MESSAGE, interval)
)
@@ -7,7 +7,6 @@ import fr.xephi.authme.command.PlayerCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.security.RandomString;
import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.util.Wrapper;
import org.bukkit.entity.Player;
import java.util.List;
@@ -18,9 +17,8 @@ public class CaptchaCommand extends PlayerCommand {
public void runCommand(Player player, List<String> arguments, CommandService commandService) {
final String playerNameLowerCase = player.getName().toLowerCase();
final String captcha = arguments.get(0);
Wrapper wrapper = Wrapper.getInstance();
final AuthMe plugin = wrapper.getAuthMe();
PlayerCache playerCache = wrapper.getPlayerCache();
final AuthMe plugin = commandService.getAuthMe();
PlayerCache playerCache = PlayerCache.getInstance();
// Command logic
if (playerCache.isAuthenticated(playerNameLowerCase)) {
@@ -8,7 +8,6 @@ import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.task.ChangePasswordTask;
import fr.xephi.authme.util.Wrapper;
import org.bukkit.entity.Player;
import java.util.List;
@@ -24,8 +23,7 @@ public class ChangePasswordCommand extends PlayerCommand {
String newPassword = arguments.get(1);
String name = player.getName().toLowerCase();
Wrapper wrapper = Wrapper.getInstance();
final PlayerCache playerCache = wrapper.getPlayerCache();
final PlayerCache playerCache = commandService.getPlayerCache();
if (!playerCache.isAuthenticated(name)) {
commandService.send(player, MessageKey.NOT_LOGGED_IN);
return;