Merge origin/enum into local branch

This commit is contained in:
ljacqu
2015-11-25 22:18:21 +01:00
185 changed files with 10883 additions and 9491 deletions
@@ -1,10 +1,9 @@
package fr.xephi.authme.command.executable;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.command.help.HelpProvider;
import org.bukkit.command.CommandSender;
/**
*/
@@ -1,16 +1,15 @@
package fr.xephi.authme.command.executable.authme;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Messages;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import java.util.List;
/**
*/
@@ -26,7 +25,7 @@ public class AccountsCommand extends ExecutableCommand {
// Get the player query
String playerQuery = sender.getName();
if(commandArguments.getCount() >= 1)
if (commandArguments.getCount() >= 1)
playerQuery = commandArguments.get(0);
final String playerQueryFinal = playerQuery;
@@ -1,11 +1,10 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
/**
*/
@@ -14,7 +13,7 @@ public class AuthMeCommand extends ExecutableCommand {
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// Show some version info
sender.sendMessage(ChatColor.GREEN + "This server is running " + AuthMe.PLUGIN_NAME + " v" + AuthMe.getVersionName() + "! " + ChatColor.RED + "<3");
sender.sendMessage(ChatColor.GREEN + "This server is running " + AuthMe.getPluginName() + " v" + AuthMe.getVersionName() + "! " + ChatColor.RED + "<3");
sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " help" + ChatColor.YELLOW + " to view help.");
sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " about" + ChatColor.YELLOW + " to view about.");
return true;
@@ -1,10 +1,5 @@
package fr.xephi.authme.command.executable.authme;
import java.security.NoSuchAlgorithmException;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
@@ -14,6 +9,10 @@ import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import java.security.NoSuchAlgorithmException;
/**
*/
@@ -1,12 +1,11 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Spawn;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -1,12 +1,11 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -19,11 +18,12 @@ public class ForceLoginCommand extends ExecutableCommand {
// Get the player query
String playerName = sender.getName();
if(commandArguments.getCount() >= 1)
if (commandArguments.getCount() >= 1)
playerName = commandArguments.get(0);
// Command logic
try {
@SuppressWarnings("deprecation")
Player player = Bukkit.getPlayer(playerName);
if (player == null || !player.isOnline()) {
sender.sendMessage("Player needs to be online!");
@@ -1,12 +1,11 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Messages;
import org.bukkit.command.CommandSender;
/**
*/
@@ -19,13 +18,13 @@ public class GetEmailCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// Get the player name
String playerName = sender.getName();
if(commandArguments.getCount() >= 1)
if (commandArguments.getCount() >= 1)
playerName = commandArguments.get(0);
// Get the authenticated user
@@ -1,12 +1,11 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -19,9 +18,10 @@ public class GetIpCommand extends ExecutableCommand {
// Get the player query
String playerName = sender.getName();
if(commandArguments.getCount() >= 1)
if (commandArguments.getCount() >= 1)
playerName = commandArguments.get(0);
@SuppressWarnings("deprecation")
Player player = Bukkit.getPlayer(playerName);
if (player == null) {
sender.sendMessage("This player is not actually online");
@@ -1,14 +1,13 @@
package fr.xephi.authme.command.executable.authme;
import java.util.Date;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Messages;
import org.bukkit.command.CommandSender;
import java.util.Date;
/**
*/
@@ -18,7 +17,7 @@ public class LastLoginCommand extends ExecutableCommand {
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// Get the player
String playerName = sender.getName();
if(commandArguments.getCount() >= 1)
if (commandArguments.getCount() >= 1)
playerName = commandArguments.get(0);
// Validate the player
@@ -1,15 +1,14 @@
package fr.xephi.authme.command.executable.authme;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Settings;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
import java.util.List;
/**
*/
@@ -22,8 +21,8 @@ public class PurgeBannedPlayersCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// AuthMe plugin instance
@@ -1,15 +1,14 @@
package fr.xephi.authme.command.executable.authme;
import java.util.Calendar;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Settings;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import java.util.Calendar;
import java.util.List;
/**
*/
@@ -22,8 +21,8 @@ public class PurgeCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// AuthMe plugin instance
@@ -36,13 +35,13 @@ public class PurgeCommand extends ExecutableCommand {
int days;
try {
days = Integer.valueOf(daysStr);
} catch(Exception ex) {
} catch (Exception ex) {
sender.sendMessage(ChatColor.RED + "The value you've entered is invalid!");
return true;
}
// Validate the value
if(days < 30) {
if (days < 30) {
sender.sendMessage(ChatColor.RED + "You can only purge data older than 30 days");
return true;
}
@@ -59,13 +58,13 @@ public class PurgeCommand extends ExecutableCommand {
sender.sendMessage(ChatColor.GOLD + "Deleted " + purged.size() + " user accounts");
// Purge other data
if(Settings.purgeEssentialsFile && plugin.ess != null)
if (Settings.purgeEssentialsFile && plugin.ess != null)
plugin.dataManager.purgeEssentials(purged);
if(Settings.purgePlayerDat)
if (Settings.purgePlayerDat)
plugin.dataManager.purgeDat(purged);
if(Settings.purgeLimitedCreative)
if (Settings.purgeLimitedCreative)
plugin.dataManager.purgeLimitedCreative(purged);
if(Settings.purgeAntiXray)
if (Settings.purgeAntiXray)
plugin.dataManager.purgeAntiXray(purged);
// Show a status message
@@ -1,14 +1,13 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Messages;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -21,8 +20,8 @@ public class PurgeLastPositionCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// AuthMe plugin instance
@@ -33,7 +32,7 @@ public class PurgeLastPositionCommand extends ExecutableCommand {
// Get the player
String playerName = sender.getName();
if(commandArguments.getCount() >= 1)
if (commandArguments.getCount() >= 1)
playerName = commandArguments.get(0);
String playerNameLowerCase = playerName.toLowerCase();
@@ -1,10 +1,5 @@
package fr.xephi.authme.command.executable.authme;
import java.security.NoSuchAlgorithmException;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
@@ -13,6 +8,10 @@ import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import java.security.NoSuchAlgorithmException;
/**
*/
@@ -25,8 +24,8 @@ public class RegisterCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// AuthMe plugin instance
@@ -1,7 +1,6 @@
package fr.xephi.authme.command.executable.authme;
//import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
@@ -10,6 +9,7 @@ import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.util.Profiler;
import org.bukkit.command.CommandSender;
/**
*/
@@ -22,8 +22,8 @@ public class ReloadCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// Profile the reload process
@@ -1,14 +1,13 @@
package fr.xephi.authme.command.executable.authme;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import java.util.List;
/**
*/
@@ -21,8 +20,8 @@ public class ResetNameCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// AuthMe plugin instance
@@ -33,7 +32,7 @@ public class ResetNameCommand extends ExecutableCommand {
@Override
public void run() {
List<PlayerAuth> authentications = plugin.database.getAllAuths();
for(PlayerAuth auth : authentications) {
for (PlayerAuth auth : authentications) {
auth.setRealName("Player");
plugin.database.updateSession(auth);
}
@@ -1,7 +1,5 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
@@ -9,6 +7,7 @@ import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings;
import org.bukkit.command.CommandSender;
/**
*/
@@ -21,8 +20,8 @@ public class SetEmailCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// AuthMe plugin instance
@@ -1,12 +1,11 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Spawn;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -19,8 +18,8 @@ public class SetFirstSpawnCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
try {
@@ -1,12 +1,11 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Spawn;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -19,8 +18,8 @@ public class SetSpawnCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// Make sure the command executor is a player
@@ -1,12 +1,11 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Spawn;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -19,8 +18,8 @@ public class SpawnCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// Make sure the command executor is a player
@@ -1,12 +1,11 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.AntiBot;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.command.help.HelpProvider;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
/**
*/
@@ -19,29 +18,30 @@ public class SwitchAntiBotCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// AuthMe plugin instance
final AuthMe plugin = AuthMe.getInstance();
// Get the new state
String newState = plugin.getAntiBotModMode() ? "OFF" : "ON";
if(commandArguments.getCount() >= 1)
String newState = null;
if (commandArguments.getCount() == 1) {
newState = commandArguments.get(0);
} else if(commandArguments.getCount() == 0) {
sender.sendMessage("[AuthMe] AntiBot status: " + AntiBot.getAntiBotStatus().name());
return true;
}
// Enable the mod
if(newState.equalsIgnoreCase("ON")) {
plugin.switchAntiBotMod(true);
sender.sendMessage("[AuthMe] AntiBotMod enabled");
if (newState.equalsIgnoreCase("ON")) {
AntiBot.overrideAntiBotStatus(true);
sender.sendMessage("[AuthMe] AntiBot Manual Ovverride: enabled!");
return true;
}
// Disable the mod
if(newState.equalsIgnoreCase("OFF")) {
plugin.switchAntiBotMod(false);
sender.sendMessage("[AuthMe] AntiBotMod disabled");
if (newState.equalsIgnoreCase("OFF")) {
AntiBot.overrideAntiBotStatus(false);
sender.sendMessage("[AuthMe] AntiBotMod Manual Ovverride: disabled!");
return true;
}
@@ -1,24 +1,24 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
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.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.MessageKey;
import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.task.MessageTask;
import fr.xephi.authme.task.TimeoutTask;
import fr.xephi.authme.util.Utils;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
/**
*/
@@ -30,8 +30,9 @@ public class UnregisterCommand extends ExecutableCommand {
* @param sender The command sender.
* @param commandReference The command reference.
* @param commandArguments The command arguments.
* @return True if the command was executed successfully, false otherwise. */
*
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// AuthMe plugin instance
@@ -46,18 +47,17 @@ public class UnregisterCommand extends ExecutableCommand {
// Make sure the user is valid
if (!plugin.database.isAuthAvailable(playerNameLowerCase)) {
m.send(sender, "user_unknown");
m.send(sender, MessageKey.UNKNOWN_USER);
return true;
}
// Remove the player
if (!plugin.database.removeAuth(playerNameLowerCase)) {
m.send(sender, "error");
m.send(sender, MessageKey.ERROR);
return true;
}
// Unregister the player
@SuppressWarnings("deprecation")
Player target = Bukkit.getPlayer(playerNameLowerCase);
PlayerCache.getInstance().removePlayer(playerNameLowerCase);
Utils.setGroup(target, Utils.GroupType.UNREGISTERED);
@@ -71,19 +71,21 @@ public class UnregisterCommand extends ExecutableCommand {
BukkitTask id = scheduler.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, playerNameLowerCase, target), delay);
LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setTimeoutTaskId(id);
}
LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setMessageTaskId(scheduler.runTaskAsynchronously(plugin, new MessageTask(plugin, playerNameLowerCase, m.send("reg_msg"), interval)));
LimboCache.getInstance().getLimboPlayer(playerNameLowerCase).setMessageTaskId(
scheduler.runTaskAsynchronously(plugin,
new MessageTask(plugin, playerNameLowerCase, m.retrieve(MessageKey.REGISTER_MESSAGE), interval)));
if (Settings.applyBlindEffect)
target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) {
target.setWalkSpeed(0.0f);
target.setFlySpeed(0.0f);
}
m.send(target, "unregistered");
m.send(target, MessageKey.UNREGISTERED_SUCCESS);
}
// Show a status message
m.send(sender, "unregistered");
m.send(sender, MessageKey.UNREGISTERED_SUCCESS);
ConsoleLogger.info(playerName + " unregistered");
return true;
}
@@ -1,13 +1,12 @@
package fr.xephi.authme.command.executable.authme;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -20,13 +19,13 @@ public class VersionCommand extends ExecutableCommand {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// Show some version info
sender.sendMessage(ChatColor.GOLD + "==========[ " + AuthMe.PLUGIN_NAME.toUpperCase() + " ABOUT ]==========");
sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + AuthMe.PLUGIN_NAME + " v" + AuthMe.getVersionName() + ChatColor.GRAY + " (code: " + AuthMe.getVersionCode() + ")");
sender.sendMessage(ChatColor.GOLD + "==========[ " + AuthMe.getPluginName().toUpperCase() + " ABOUT ]==========");
sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + AuthMe.getPluginName() + " v" + AuthMe.getVersionName() + ChatColor.GRAY + " (code: " + AuthMe.getVersionCode() + ")");
sender.sendMessage(ChatColor.GOLD + "Developers:");
printDeveloper(sender, "Xephi", "xephi59", "Lead Developer");
printDeveloper(sender, "DNx5", "DNx5", "Developer");
@@ -42,10 +41,10 @@ public class VersionCommand extends ExecutableCommand {
/**
* Print a developer with proper styling.
*
* @param sender The command sender.
* @param name The display name of the developer.
* @param sender The command sender.
* @param name The display name of the developer.
* @param minecraftName The Minecraft username of the developer, if available.
* @param function The function of the developer.
* @param function The function of the developer.
*/
@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
private void printDeveloper(CommandSender sender, String name, String minecraftName, String function) {
@@ -55,13 +54,13 @@ public class VersionCommand extends ExecutableCommand {
msg.append(name);
// Append the Minecraft name, if available
if(minecraftName.length() != 0)
if (minecraftName.length() != 0)
msg.append(ChatColor.GRAY + " // " + ChatColor.WHITE + minecraftName);
msg.append(ChatColor.GRAY + "" + ChatColor.ITALIC + " (" + function + ")");
// Show the online status
if(minecraftName.length() != 0)
if(isPlayerOnline(minecraftName))
if (minecraftName.length() != 0)
if (isPlayerOnline(minecraftName))
msg.append(ChatColor.GREEN + "" + ChatColor.ITALIC + " (In-Game)");
// Print the message
@@ -73,12 +72,16 @@ public class VersionCommand extends ExecutableCommand {
*
* @param minecraftName The Minecraft player name.
*
* @return True if the player is online, false otherwise. */
* @return True if the player is online, false otherwise.
*/
private boolean isPlayerOnline(String minecraftName) {
for(Player player : Bukkit.getOnlinePlayers())
if(player.getName().equalsIgnoreCase(minecraftName))
// Note ljacqu 20151121: Generally you should use Utils#getOnlinePlayers to retrieve the list of online players.
// If it's only used in a for-each loop such as here, it's fine. For other purposes, go through the Utils class.
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getName().equalsIgnoreCase(minecraftName)) {
return true;
}
}
return false;
}
}
@@ -1,45 +1,24 @@
package fr.xephi.authme.command.executable.captcha;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.security.RandomString;
import fr.xephi.authme.settings.MessageKey;
import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
public class CaptchaCommand extends ExecutableCommand {
/**
* Execute the command.
*
* @param sender The command sender.
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// AuthMe plugin instance
final AuthMe plugin = AuthMe.getInstance();
// Messages instance
final Messages m = Messages.getInstance();
// Random string instance, for captcha generation (I think) -- timvisee
RandomString randStr = new RandomString(Settings.captchaLength);
// Get the parameter values
String captcha = commandArguments.get(0);
// Make sure the current command executor is a player
if(!(sender instanceof Player)) {
if (!(sender instanceof Player)) {
return true;
}
@@ -47,39 +26,47 @@ public class CaptchaCommand extends ExecutableCommand {
final Player player = (Player) sender;
final String playerNameLowerCase = player.getName().toLowerCase();
// Get the parameter values
String captcha = commandArguments.get(0);
// Messages instance
final Messages m = Messages.getInstance();
// Command logic
if (PlayerCache.getInstance().isAuthenticated(playerNameLowerCase)) {
m.send(player, "logged_in");
m.send(player, MessageKey.ALREADY_LOGGED_IN_ERROR);
return true;
}
if (!Settings.useCaptcha) {
m.send(player, "usage_log");
m.send(player, MessageKey.USAGE_LOGIN);
return true;
}
// AuthMe plugin instance
final AuthMe plugin = AuthMe.getInstance();
if (!plugin.cap.containsKey(playerNameLowerCase)) {
m.send(player, "usage_log");
m.send(player, MessageKey.USAGE_LOGIN);
return true;
}
if (Settings.useCaptcha && !captcha.equals(plugin.cap.get(playerNameLowerCase))) {
plugin.cap.remove(playerNameLowerCase);
plugin.cap.put(playerNameLowerCase, randStr.nextString());
for (String s : m.send("wrong_captcha")) {
String randStr = new RandomString(Settings.captchaLength).nextString();
plugin.cap.put(playerNameLowerCase, randStr);
for (String s : m.retrieve(MessageKey.CAPTCHA_WRONG_ERROR)) {
player.sendMessage(s.replace("THE_CAPTCHA", plugin.cap.get(playerNameLowerCase)));
}
return true;
}
try {
plugin.captcha.remove(playerNameLowerCase);
plugin.cap.remove(playerNameLowerCase);
} catch (NullPointerException ignored) { }
plugin.captcha.remove(playerNameLowerCase);
plugin.cap.remove(playerNameLowerCase);
// Show a status message
m.send(player, "valid_captcha");
m.send(player, "login_msg");
m.send(player, MessageKey.CAPTCHA_SUCCESS);
m.send(player, MessageKey.LOGIN_MESSAGE);
return true;
}
}
@@ -1,8 +1,5 @@
package fr.xephi.authme.command.executable.changepassword;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.command.CommandParts;
@@ -10,6 +7,8 @@ import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.task.ChangePasswordTask;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -1,21 +1,12 @@
package fr.xephi.authme.command.executable.converter;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.converter.Converter;
import fr.xephi.authme.converter.CrazyLoginConverter;
import fr.xephi.authme.converter.FlatToSql;
import fr.xephi.authme.converter.FlatToSqlite;
import fr.xephi.authme.converter.RakamakConverter;
import fr.xephi.authme.converter.RoyalAuthConverter;
import fr.xephi.authme.converter.SqlToFlat;
import fr.xephi.authme.converter.vAuthConverter;
import fr.xephi.authme.converter.xAuthConverter;
import fr.xephi.authme.converter.*;
import fr.xephi.authme.settings.Messages;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
/**
*/
@@ -24,12 +15,12 @@ public class ConverterCommand extends ExecutableCommand {
/**
* Execute the command.
*
* @param sender The command sender.
* @param sender The command sender.
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// AuthMe plugin instance
@@ -51,32 +42,32 @@ public class ConverterCommand extends ExecutableCommand {
// Get the proper converter instance
Converter converter = null;
switch (jobType) {
case ftsql:
converter = new FlatToSql();
break;
case ftsqlite:
converter = new FlatToSqlite(sender);
break;
case xauth:
converter = new xAuthConverter(plugin, sender);
break;
case crazylogin:
converter = new CrazyLoginConverter(plugin, sender);
break;
case rakamak:
converter = new RakamakConverter(plugin, sender);
break;
case royalauth:
converter = new RoyalAuthConverter(plugin);
break;
case vauth:
converter = new vAuthConverter(plugin, sender);
break;
case sqltoflat:
converter = new SqlToFlat(plugin, sender);
break;
default:
break;
case ftsql:
converter = new FlatToSql();
break;
case ftsqlite:
converter = new FlatToSqlite(sender);
break;
case xauth:
converter = new xAuthConverter(plugin, sender);
break;
case crazylogin:
converter = new CrazyLoginConverter(plugin, sender);
break;
case rakamak:
converter = new RakamakConverter(plugin, sender);
break;
case royalauth:
converter = new RoyalAuthConverter(plugin);
break;
case vauth:
converter = new vAuthConverter(plugin, sender);
break;
case sqltoflat:
converter = new SqlToFlat(plugin, sender);
break;
default:
break;
}
// Run the convert job
@@ -99,29 +90,24 @@ public class ConverterCommand extends ExecutableCommand {
vauth("vauth"),
sqltoflat("sqltoflat");
String name;
final String name;
/**
* Constructor for ConvertType.
*
* @param name String
*/
ConvertType(String name) {
this.name = name;
}
/**
* Method getName.
* @return String */
String getName() {
return this.name;
}
/**
* Method fromName.
*
* @param name String
* @return ConvertType */
*
* @return ConvertType
*/
public static ConvertType fromName(String name) {
for (ConvertType type : ConvertType.values()) {
if (type.getName().equalsIgnoreCase(name))
@@ -129,5 +115,14 @@ public class ConverterCommand extends ExecutableCommand {
}
return null;
}
/**
* Method getName.
*
* @return String
*/
String getName() {
return this.name;
}
}
}
@@ -1,12 +1,10 @@
package fr.xephi.authme.command.executable.email;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Messages;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -1,11 +1,10 @@
package fr.xephi.authme.command.executable.email;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -1,10 +1,5 @@
package fr.xephi.authme.command.executable.email;
import java.security.NoSuchAlgorithmException;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
@@ -15,6 +10,10 @@ import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.security.RandomString;
import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.security.NoSuchAlgorithmException;
/**
*/
@@ -1,11 +1,10 @@
package fr.xephi.authme.command.executable.login;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -21,10 +20,10 @@ public class LoginCommand extends ExecutableCommand {
// Get the necessary objects
final AuthMe plugin = AuthMe.getInstance();
final Player player = (Player) sender;
final String playerPass = commandArguments.get(0);
final String password = commandArguments.get(0);
// Log the player in
plugin.getManagement().performLogin(player, playerPass, false);
plugin.getManagement().performLogin(player, password, false);
return true;
}
}
@@ -1,11 +1,10 @@
package fr.xephi.authme.command.executable.logout;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -1,15 +1,14 @@
package fr.xephi.authme.command.executable.register;
import fr.xephi.authme.process.Management;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.process.Management;
import fr.xephi.authme.security.RandomString;
import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -1,13 +1,12 @@
package fr.xephi.authme.command.executable.unregister;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Messages;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*/
@@ -16,12 +15,12 @@ public class UnregisterCommand extends ExecutableCommand {
/**
* Execute the command.
*
* @param sender The command sender.
* @param sender The command sender.
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True if the command was executed successfully, false otherwise. */
* @return True if the command was executed successfully, false otherwise.
*/
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// AuthMe plugin instance
@@ -31,7 +30,7 @@ public class UnregisterCommand extends ExecutableCommand {
final Messages m = Messages.getInstance();
// Make sure the current command executor is a player
if(!(sender instanceof Player)) {
if (!(sender instanceof Player)) {
return true;
}