#306 Adjust ExecutableCommand implementations to interface

This commit is contained in:
ljacqu
2015-12-23 14:55:04 +01:00
parent 8ef1b2ae3e
commit 14f6ecd716
37 changed files with 124 additions and 82 deletions
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@@ -10,10 +11,10 @@ import java.util.List;
/**
* AuthMe base command; shows the version and some command pointers.
*/
public class AuthMeCommand extends ExecutableCommand {
public class AuthMeCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
sender.sendMessage(ChatColor.GREEN + "This server is running " + AuthMe.getPluginName() + " v"
+ AuthMe.getPluginVersion() + " b" + AuthMe.getPluginBuildNumber()+ "! " + ChatColor.RED + "<3");
sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/authme help" + ChatColor.YELLOW
@@ -4,6 +4,7 @@ import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -18,10 +19,10 @@ import java.util.List;
/**
* Admin command for changing a player's password.
*/
public class ChangePasswordAdminCommand extends ExecutableCommand {
public class ChangePasswordAdminCommand implements ExecutableCommand {
@Override
public void executeCommand(final CommandSender sender, List<String> arguments) {
public void executeCommand(final CommandSender sender, List<String> arguments, CommandService commandService) {
final AuthMe plugin = AuthMe.getInstance();
final Messages m = plugin.getMessages();
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Spawn;
import org.bukkit.command.CommandSender;
@@ -8,10 +9,10 @@ import org.bukkit.entity.Player;
import java.util.List;
public class FirstSpawnCommand extends ExecutableCommand {
public class FirstSpawnCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Make sure the command executor is a player
try {
if (sender instanceof Player) {
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.permission.PlayerPermission;
import org.bukkit.Bukkit;
@@ -11,10 +12,10 @@ import java.util.List;
/**
*/
public class ForceLoginCommand extends ExecutableCommand {
public class ForceLoginCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// AuthMe plugin instance
final AuthMe plugin = AuthMe.getInstance();
@@ -2,6 +2,7 @@ package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -9,10 +10,10 @@ import org.bukkit.command.CommandSender;
import java.util.List;
public class GetEmailCommand extends ExecutableCommand {
public class GetEmailCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
String playerName = arguments.isEmpty() ? sender.getName() : arguments.get(0);
// Get the authenticated user
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@@ -8,10 +9,10 @@ import org.bukkit.entity.Player;
import java.util.List;
public class GetIpCommand extends ExecutableCommand {
public class GetIpCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
final AuthMe plugin = AuthMe.getInstance();
// Get the player query
@@ -2,6 +2,7 @@ package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -12,10 +13,10 @@ import java.util.List;
/**
*/
public class LastLoginCommand extends ExecutableCommand {
public class LastLoginCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Get the player
String playerName = (arguments.size() >= 1) ? arguments.get(0) : sender.getName();
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Settings;
import org.bukkit.OfflinePlayer;
@@ -9,10 +10,10 @@ import org.bukkit.command.CommandSender;
import java.util.ArrayList;
import java.util.List;
public class PurgeBannedPlayersCommand extends ExecutableCommand {
public class PurgeBannedPlayersCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// AuthMe plugin instance
final AuthMe plugin = AuthMe.getInstance();
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Settings;
import org.bukkit.ChatColor;
@@ -9,10 +10,10 @@ import org.bukkit.command.CommandSender;
import java.util.Calendar;
import java.util.List;
public class PurgeCommand extends ExecutableCommand {
public class PurgeCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// AuthMe plugin instance
AuthMe plugin = AuthMe.getInstance();
@@ -3,6 +3,7 @@ package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -11,10 +12,10 @@ import org.bukkit.entity.Player;
import java.util.List;
public class PurgeLastPositionCommand extends ExecutableCommand {
public class PurgeLastPositionCommand implements ExecutableCommand {
@Override
public void executeCommand(final CommandSender sender, List<String> arguments) {
public void executeCommand(final CommandSender sender, List<String> arguments, CommandService commandService) {
final AuthMe plugin = AuthMe.getInstance();
final Messages m = plugin.getMessages();
@@ -3,6 +3,7 @@ package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -17,10 +18,10 @@ import java.util.List;
/**
* Admin command to register a user.
*/
public class RegisterAdminCommand extends ExecutableCommand {
public class RegisterAdminCommand implements ExecutableCommand {
@Override
public void executeCommand(final CommandSender sender, List<String> arguments) {
public void executeCommand(final CommandSender sender, List<String> arguments, CommandService commandService) {
// AuthMe plugin instance
final AuthMe plugin = AuthMe.getInstance();
@@ -2,6 +2,7 @@ package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -11,10 +12,10 @@ import org.bukkit.command.CommandSender;
import java.util.List;
public class ReloadCommand extends ExecutableCommand {
public class ReloadCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Profile the reload process
Profiler p = new Profiler(true);
@@ -3,6 +3,7 @@ package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -11,10 +12,10 @@ import org.bukkit.command.CommandSender;
import java.util.List;
public class SetEmailCommand extends ExecutableCommand {
public class SetEmailCommand implements ExecutableCommand {
@Override
public void executeCommand(final CommandSender sender, List<String> arguments) {
public void executeCommand(final CommandSender sender, List<String> arguments, CommandService commandService) {
// AuthMe plugin instance
final AuthMe plugin = AuthMe.getInstance();
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Spawn;
import org.bukkit.command.CommandSender;
@@ -8,10 +9,10 @@ import org.bukkit.entity.Player;
import java.util.List;
public class SetFirstSpawnCommand extends ExecutableCommand {
public class SetFirstSpawnCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
try {
if (sender instanceof Player) {
if (Spawn.getInstance().setFirstSpawn(((Player) sender).getLocation()))
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Spawn;
import org.bukkit.command.CommandSender;
@@ -8,10 +9,10 @@ import org.bukkit.entity.Player;
import java.util.List;
public class SetSpawnCommand extends ExecutableCommand {
public class SetSpawnCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Make sure the command executor is a player
try {
if (sender instanceof Player) {
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Spawn;
import org.bukkit.command.CommandSender;
@@ -8,10 +9,10 @@ import org.bukkit.entity.Player;
import java.util.List;
public class SpawnCommand extends ExecutableCommand {
public class SpawnCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Make sure the command executor is a player
try {
if (sender instanceof Player) {
@@ -4,6 +4,7 @@ import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -23,11 +24,11 @@ import java.util.List;
/**
* Admin command to unregister a player.
*/
public class UnregisterAdminCommand extends ExecutableCommand {
public class UnregisterAdminCommand implements ExecutableCommand {
@Override
public void executeCommand(final CommandSender sender, List<String> arguments) {
public void executeCommand(final CommandSender sender, List<String> arguments, CommandService commandService) {
// AuthMe plugin instance
final AuthMe plugin = AuthMe.getInstance();
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Settings;
import org.bukkit.Bukkit;
@@ -10,10 +11,10 @@ import org.bukkit.entity.Player;
import java.util.List;
public class VersionCommand extends ExecutableCommand {
public class VersionCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Show some version info
sender.sendMessage(ChatColor.GOLD + "==========[ " + Settings.helpHeader.toUpperCase() + " ABOUT ]==========");
sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + AuthMe.getPluginName() + " v" + AuthMe.getPluginVersion() + ChatColor.GRAY + " (build: " + AuthMe.getPluginBuildNumber() + ")");
@@ -2,6 +2,7 @@ package fr.xephi.authme.command.executable.captcha;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -13,10 +14,10 @@ import org.bukkit.entity.Player;
import java.util.List;
public class CaptchaCommand extends ExecutableCommand {
public class CaptchaCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Make sure the current command executor is a player
if (!(sender instanceof Player)) {
return;
@@ -2,6 +2,7 @@ package fr.xephi.authme.command.executable.changepassword;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -16,10 +17,10 @@ import java.util.List;
/**
* The command for a player to change his password with.
*/
public class ChangePasswordCommand extends ExecutableCommand {
public class ChangePasswordCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Make sure the current command executor is a player
if (!(sender instanceof Player)) {
return;
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.converter;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.converter.Converter;
import fr.xephi.authme.converter.CrazyLoginConverter;
@@ -19,10 +20,10 @@ import org.bukkit.command.CommandSender;
import java.util.List;
public class ConverterCommand extends ExecutableCommand {
public class ConverterCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// AuthMe plugin instance
final AuthMe plugin = AuthMe.getInstance();
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.email;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.util.Wrapper;
import org.bukkit.command.CommandSender;
@@ -8,10 +9,10 @@ import org.bukkit.entity.Player;
import java.util.List;
public class AddEmailCommand extends ExecutableCommand {
public class AddEmailCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Make sure the current command executor is a player
if (!(sender instanceof Player)) {
return;
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.email;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.util.Wrapper;
import org.bukkit.command.CommandSender;
@@ -10,10 +11,10 @@ import java.util.List;
/**
*/
public class ChangeEmailCommand extends ExecutableCommand {
public class ChangeEmailCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Make sure the current command executor is a player
if (!(sender instanceof Player)) {
return;
@@ -4,6 +4,7 @@ import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -17,10 +18,10 @@ import org.bukkit.entity.Player;
import java.security.NoSuchAlgorithmException;
import java.util.List;
public class RecoverEmailCommand extends ExecutableCommand {
public class RecoverEmailCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Make sure the current command executor is a player
if (!(sender instanceof Player)) {
return;
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.login;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.util.Wrapper;
import org.bukkit.command.CommandSender;
@@ -8,10 +9,10 @@ import org.bukkit.entity.Player;
import java.util.List;
public class LoginCommand extends ExecutableCommand {
public class LoginCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Make sure the current command executor is a player
if (!(sender instanceof Player)) {
return;
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.logout;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.util.Wrapper;
import org.bukkit.command.CommandSender;
@@ -10,10 +11,10 @@ import java.util.List;
/**
*/
public class LogoutCommand extends ExecutableCommand {
public class LogoutCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Make sure the current command executor is a player
if (!(sender instanceof Player)) {
return;
@@ -1,6 +1,7 @@
package fr.xephi.authme.command.executable.register;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -13,10 +14,10 @@ import org.bukkit.entity.Player;
import java.util.List;
public class RegisterCommand extends ExecutableCommand {
public class RegisterCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Make sure the sender is a player
if (!(sender instanceof Player)) {
sender.sendMessage("Player Only! Use 'authme register <playername> <password>' instead");
@@ -2,6 +2,7 @@ package fr.xephi.authme.command.executable.unregister;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
@@ -10,10 +11,10 @@ import org.bukkit.entity.Player;
import java.util.List;
public class UnregisterCommand extends ExecutableCommand {
public class UnregisterCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments) {
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// Make sure the current command executor is a player
if (!(sender instanceof Player)) {
return;