Reformatted all code files, cleaned up the project

This commit is contained in:
Tim Visée 2015-11-23 21:32:55 +01:00
parent cffcafd36b
commit 2e868c7492
46 changed files with 1475 additions and 1475 deletions

View File

@ -67,8 +67,8 @@ public class ConsoleLogger {
} }
try { try {
Files.write(Settings.LOG_FILE.toPath(), (dateTime + ": " + message + StringUtils.newline).getBytes(), Files.write(Settings.LOG_FILE.toPath(), (dateTime + ": " + message + StringUtils.newline).getBytes(),
StandardOpenOption.APPEND, StandardOpenOption.APPEND,
StandardOpenOption.CREATE); StandardOpenOption.CREATE);
} catch (IOException ignored) { } catch (IOException ignored) {
} }
} }

View File

@ -19,8 +19,8 @@ public class Log4JFilter implements org.apache.logging.log4j.core.Filter {
* List of commands (lower-case) to skip. * List of commands (lower-case) to skip.
*/ */
private static final String[] COMMANDS_TO_SKIP = {"/login ", "/l ", "/reg ", "/changepassword ", private static final String[] COMMANDS_TO_SKIP = {"/login ", "/l ", "/reg ", "/changepassword ",
"/unregister ", "/authme register ", "/authme changepassword ", "/authme reg ", "/authme cp ", "/unregister ", "/authme register ", "/authme changepassword ", "/authme reg ", "/authme cp ",
"/register "}; "/register "};
/** /**
* Constructor. * Constructor.
@ -57,7 +57,7 @@ public class Log4JFilter implements org.apache.logging.log4j.core.Filter {
String lowerMessage = message.toLowerCase(); String lowerMessage = message.toLowerCase();
if (lowerMessage.contains("issued server command:") if (lowerMessage.contains("issued server command:")
&& StringUtils.containsAny(lowerMessage, COMMANDS_TO_SKIP)) { && StringUtils.containsAny(lowerMessage, COMMANDS_TO_SKIP)) {
return Result.DENY; return Result.DENY;
} }
return Result.NEUTRAL; return Result.NEUTRAL;

View File

@ -38,7 +38,7 @@ public class PerformBackup {
* @param cause BackupCause The cause of the backup. * @param cause BackupCause The cause of the backup.
*/ */
public void doBackup(BackupCause cause) { public void doBackup(BackupCause cause) {
if(!Settings.isBackupActivated) { if (!Settings.isBackupActivated) {
ConsoleLogger.showError("Can't perform a Backup: disabled in configuration. Cause of the Backup: " + cause.name()); ConsoleLogger.showError("Can't perform a Backup: disabled in configuration. Cause of the Backup: " + cause.name());
} }
// Check whether a backup should be made at the specified point in time // Check whether a backup should be made at the specified point in time

View File

@ -437,12 +437,12 @@ public class PlayerAuth {
@Override @Override
public String toString() { public String toString() {
return ("Player : " + nickname + " | " + realName return ("Player : " + nickname + " | " + realName
+ " ! IP : " + ip + " ! IP : " + ip
+ " ! LastLogin : " + lastLogin + " ! LastLogin : " + lastLogin
+ " ! LastPosition : " + x + "," + y + "," + z + "," + world + " ! LastPosition : " + x + "," + y + "," + z + "," + world
+ " ! Email : " + email + " ! Email : " + email
+ " ! Hash : " + hash + " ! Hash : " + hash
+ " ! Salt : " + salt); + " ! Salt : " + salt);
} }
} }

View File

@ -25,10 +25,10 @@ public class JsonCache {
ConsoleLogger.showError("Failed to create cache directory."); ConsoleLogger.showError("Failed to create cache directory.");
} }
gson = new GsonBuilder() gson = new GsonBuilder()
.registerTypeAdapter(DataFileCache.class, new PlayerDataSerializer()) .registerTypeAdapter(DataFileCache.class, new PlayerDataSerializer())
.registerTypeAdapter(DataFileCache.class, new PlayerDataDeserializer()) .registerTypeAdapter(DataFileCache.class, new PlayerDataDeserializer())
.setPrettyPrinting() .setPrettyPrinting()
.create(); .create();
} }
/** /**

View File

@ -781,10 +781,10 @@ public class CommandDescription {
// Check whether this description is for the last element in the command reference, if so return the current command // Check whether this description is for the last element in the command reference, if so return the current command
if (queryReference.getCount() <= getParentCount() + 1) if (queryReference.getCount() <= getParentCount() + 1)
return new FoundCommandResult( return new FoundCommandResult(
this, this,
getCommandReference(queryReference), getCommandReference(queryReference),
new CommandParts(), new CommandParts(),
queryReference); queryReference);
// Get the new command reference and arguments // Get the new command reference and arguments
CommandParts newReference = new CommandParts(queryReference.getRange(0, getParentCount() + 1)); CommandParts newReference = new CommandParts(queryReference.getRange(0, getParentCount() + 1));
@ -798,8 +798,8 @@ public class CommandDescription {
@Override @Override
public int compare(CommandDescription o1, CommandDescription o2) { public int compare(CommandDescription o1, CommandDescription o2) {
return Double.compare( return Double.compare(
o1.getCommandDifference(queryReference), o1.getCommandDifference(queryReference),
o2.getCommandDifference(queryReference)); o2.getCommandDifference(queryReference));
} }
}); });

View File

@ -133,7 +133,7 @@ public class CommandHandler {
// Show the suggested command // Show the suggested command
sender.sendMessage(ChatColor.DARK_RED + "Unknown command, assuming " + ChatColor.GOLD + "/" + suggestedCommandParts + sender.sendMessage(ChatColor.DARK_RED + "Unknown command, assuming " + ChatColor.GOLD + "/" + suggestedCommandParts +
ChatColor.DARK_RED + "!"); ChatColor.DARK_RED + "!");
} }
// Make sure the command is executable // Make sure the command is executable

View File

@ -29,13 +29,13 @@ public final class HelpSyntaxHelper {
String alternativeLabel, boolean highlight) { String alternativeLabel, boolean highlight) {
// Create a string builder with white color and prefixed slash // Create a string builder with white color and prefixed slash
StringBuilder sb = new StringBuilder() StringBuilder sb = new StringBuilder()
.append(ChatColor.WHITE) .append(ChatColor.WHITE)
.append("/"); .append("/");
// Get the help command reference, and the command label // Get the help command reference, and the command label
CommandParts helpCommandReference = commandDescription.getCommandReference(commandReference); CommandParts helpCommandReference = commandDescription.getCommandReference(commandReference);
final String parentCommand = new CommandParts( final String parentCommand = new CommandParts(
helpCommandReference.getRange(0, helpCommandReference.getCount() - 1)).toString(); helpCommandReference.getRange(0, helpCommandReference.getCount() - 1)).toString();
// Check whether the alternative label should be used // Check whether the alternative label should be used
String commandLabel; String commandLabel;
@ -47,9 +47,9 @@ public final class HelpSyntaxHelper {
// Show the important bit of the command, highlight this part if required // Show the important bit of the command, highlight this part if required
sb.append(parentCommand) sb.append(parentCommand)
.append(" ") .append(" ")
.append(highlight ? ChatColor.YELLOW.toString() + ChatColor.BOLD : "") .append(highlight ? ChatColor.YELLOW.toString() + ChatColor.BOLD : "")
.append(commandLabel); .append(commandLabel);
if (highlight) { if (highlight) {
sb.append(ChatColor.YELLOW); sb.append(ChatColor.YELLOW);

File diff suppressed because it is too large Load Diff

View File

@ -66,7 +66,7 @@ public class AuthMeInventoryPacketAdapter extends PacketAdapter {
byte windowId = packet.getIntegers().read(0).byteValue(); byte windowId = packet.getIntegers().read(0).byteValue();
if (windowId == PLAYER_INVENTORY && Settings.protectInventoryBeforeLogInEnabled if (windowId == PLAYER_INVENTORY && Settings.protectInventoryBeforeLogInEnabled
&& !PlayerCache.getInstance().isAuthenticated(player.getName())) { && !PlayerCache.getInstance().isAuthenticated(player.getName())) {
packetEvent.setCancelled(true); packetEvent.setCancelled(true);
} }
} }
@ -108,9 +108,9 @@ public class AuthMeInventoryPacketAdapter extends PacketAdapter {
//storedInventory and hotbar //storedInventory and hotbar
System.arraycopy(storedInventory, 0, completeInventory System.arraycopy(storedInventory, 0, completeInventory
, playerCrafting.length + armorContents.length, storedInventory.length); , playerCrafting.length + armorContents.length, storedInventory.length);
System.arraycopy(hotbar, 0, completeInventory System.arraycopy(hotbar, 0, completeInventory
, playerCrafting.length + armorContents.length + storedInventory.length, hotbar.length); , playerCrafting.length + armorContents.length + storedInventory.length, hotbar.length);
inventoryPacket.getItemArrayModifier().write(0, completeInventory); inventoryPacket.getItemArrayModifier().write(0, completeInventory);
try { try {

View File

@ -29,10 +29,10 @@ import java.util.logging.Logger;
/** /**
* PermissionsManager. * PermissionsManager.
* <p> * <p/>
* A permissions manager, to manage and use various permissions systems. * A permissions manager, to manage and use various permissions systems.
* This manager supports dynamic plugin hooking and various other features. * This manager supports dynamic plugin hooking and various other features.
* <p> * <p/>
* Written by Tim Visée. * Written by Tim Visée.
* *
* @author Tim Visée, http://timvisee.com * @author Tim Visée, http://timvisee.com
@ -267,9 +267,9 @@ public class PermissionsManager {
// Check if any known permissions system is enabling // Check if any known permissions system is enabling
if (pluginName.equals("PermissionsEx") || pluginName.equals("PermissionsBukkit") || if (pluginName.equals("PermissionsEx") || pluginName.equals("PermissionsBukkit") ||
pluginName.equals("bPermissions") || pluginName.equals("GroupManager") || pluginName.equals("bPermissions") || pluginName.equals("GroupManager") ||
pluginName.equals("zPermissions") || pluginName.equals("Vault") || pluginName.equals("zPermissions") || pluginName.equals("Vault") ||
pluginName.equals("Permissions")) { pluginName.equals("Permissions")) {
this.log.info(pluginName + " plugin enabled, dynamically updating permissions hooks!"); this.log.info(pluginName + " plugin enabled, dynamically updating permissions hooks!");
setup(); setup();
} }
@ -287,9 +287,9 @@ public class PermissionsManager {
// Is the WorldGuard plugin disabled // Is the WorldGuard plugin disabled
if (pluginName.equals("PermissionsEx") || pluginName.equals("PermissionsBukkit") || if (pluginName.equals("PermissionsEx") || pluginName.equals("PermissionsBukkit") ||
pluginName.equals("bPermissions") || pluginName.equals("GroupManager") || pluginName.equals("bPermissions") || pluginName.equals("GroupManager") ||
pluginName.equals("zPermissions") || pluginName.equals("Vault") || pluginName.equals("zPermissions") || pluginName.equals("Vault") ||
pluginName.equals("Permissions")) { pluginName.equals("Permissions")) {
this.log.info(pluginName + " plugin disabled, updating hooks!"); this.log.info(pluginName + " plugin disabled, updating hooks!");
setup(); setup();
} }
@ -915,4 +915,4 @@ public class PermissionsManager {
return this.name; return this.name;
} }
} }
} }

View File

@ -248,7 +248,7 @@ public class AsyncronousJoin {
} }
String[] msg = isAuthAvailable ? m.send("login_msg") : String[] msg = isAuthAvailable ? m.send("login_msg") :
m.send("reg_" + (Settings.emailRegistration ? "email_" : "") + "msg"); m.send("reg_" + (Settings.emailRegistration ? "email_" : "") + "msg");
BukkitTask msgTask = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, msg, msgInterval)); BukkitTask msgTask = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, msg, msgInterval));
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgTask); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgTask);
} }
@ -306,7 +306,7 @@ public class AsyncronousJoin {
Material cur = player.getLocation().getBlock().getType(); Material cur = player.getLocation().getBlock().getType();
Material top = player.getLocation().add(0D, 1D, 0D).getBlock().getType(); Material top = player.getLocation().add(0D, 1D, 0D).getBlock().getType();
if (cur == Material.PORTAL || cur == Material.ENDER_PORTAL if (cur == Material.PORTAL || cur == Material.ENDER_PORTAL
|| top == Material.PORTAL || top == Material.ENDER_PORTAL) { || top == Material.PORTAL || top == Material.ENDER_PORTAL) {
m.send(player, "unsafe_spawn"); m.send(player, "unsafe_spawn");
player.teleport(spawnLoc); player.teleport(spawnLoc);
} }

View File

@ -25,8 +25,8 @@ public class ProcessSyncronousPlayerQuit implements Runnable {
* @param needToChange boolean * @param needToChange boolean
*/ */
public ProcessSyncronousPlayerQuit(AuthMe plugin, Player player public ProcessSyncronousPlayerQuit(AuthMe plugin, Player player
, boolean isOp, boolean isFlying , boolean isOp, boolean isFlying
, boolean needToChange) { , boolean needToChange) {
this.plugin = plugin; this.plugin = plugin;
this.player = player; this.player = player;
this.isOp = isOp; this.isOp = isOp;

View File

@ -28,7 +28,7 @@ public class PasswordSecurity {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
public static String createSalt(int length) public static String createSalt(int length)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
byte[] msg = new byte[40]; byte[] msg = new byte[40];
rnd.nextBytes(msg); rnd.nextBytes(msg);
MessageDigest sha1 = MessageDigest.getInstance("SHA1"); MessageDigest sha1 = MessageDigest.getInstance("SHA1");

View File

@ -21,37 +21,37 @@ import java.security.SecureRandom;
* BCrypt implements OpenBSD-style Blowfish password hashing using the scheme * BCrypt implements OpenBSD-style Blowfish password hashing using the scheme
* described in "A Future-Adaptable Password Scheme" by Niels Provos and David * described in "A Future-Adaptable Password Scheme" by Niels Provos and David
* Mazieres. * Mazieres.
* <p> * <p/>
* This password hashing system tries to thwart off-line password cracking using * This password hashing system tries to thwart off-line password cracking using
* a computationally-intensive hashing algorithm, based on Bruce Schneier's * a computationally-intensive hashing algorithm, based on Bruce Schneier's
* Blowfish cipher. The work factor of the algorithm is parameterised, so it can * Blowfish cipher. The work factor of the algorithm is parameterised, so it can
* be increased as computers get faster. * be increased as computers get faster.
* <p> * <p/>
* Usage is really simple. To hash a password for the first time, call the * Usage is really simple. To hash a password for the first time, call the
* hashpw method with a random salt, like this: * hashpw method with a random salt, like this:
* <p> * <p/>
* <code> * <code>
* String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt()); <br /> * String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt()); <br />
* </code> * </code>
* <p> * <p/>
* To check whether a plaintext password matches one that has been hashed * To check whether a plaintext password matches one that has been hashed
* previously, use the checkpw method: * previously, use the checkpw method:
* <p> * <p/>
* <code> * <code>
* if (BCrypt.checkpw(candidate_password, stored_hash))<br /> * if (BCrypt.checkpw(candidate_password, stored_hash))<br />
* &nbsp;&nbsp;&nbsp;&nbsp;System.out.println("It matches");<br /> * &nbsp;&nbsp;&nbsp;&nbsp;System.out.println("It matches");<br />
* else<br /> * else<br />
* &nbsp;&nbsp;&nbsp;&nbsp;System.out.println("It does not match");<br /> * &nbsp;&nbsp;&nbsp;&nbsp;System.out.println("It does not match");<br />
* </code> * </code>
* <p> * <p/>
* The gensalt() method takes an optional parameter (log_rounds) that determines * The gensalt() method takes an optional parameter (log_rounds) that determines
* the computational complexity of the hashing: * the computational complexity of the hashing:
* <p> * <p/>
* <code> * <code>
* String strong_salt = BCrypt.gensalt(10)<br /> * String strong_salt = BCrypt.gensalt(10)<br />
* String stronger_salt = BCrypt.gensalt(12)<br /> * String stronger_salt = BCrypt.gensalt(12)<br />
* </code> * </code>
* <p> * <p/>
* The amount of work increases exponentially (2**log_rounds), so each increment * The amount of work increases exponentially (2**log_rounds), so each increment
* is twice as much work. The default log_rounds is 10, and the valid range is 4 * is twice as much work. The default log_rounds is 10, and the valid range is 4
* to 31. * to 31.
@ -95,7 +95,7 @@ public class BCRYPT implements EncryptionMethod {
* @return base64-encoded string * @throws IllegalArgumentException if the length is invalid * @throws IllegalArgumentException * @return base64-encoded string * @throws IllegalArgumentException if the length is invalid * @throws IllegalArgumentException
*/ */
private static String encode_base64(byte d[], int len) private static String encode_base64(byte d[], int len)
throws IllegalArgumentException { throws IllegalArgumentException {
int off = 0; int off = 0;
StringBuffer rs = new StringBuffer(); StringBuffer rs = new StringBuffer();
int c1, c2; int c1, c2;
@ -150,7 +150,7 @@ public class BCRYPT implements EncryptionMethod {
* @return an array containing the decoded bytes * @throws IllegalArgumentException if maxolen is invalid * @throws IllegalArgumentException * @return an array containing the decoded bytes * @throws IllegalArgumentException if maxolen is invalid * @throws IllegalArgumentException
*/ */
private static byte[] decode_base64(String s, int maxolen) private static byte[] decode_base64(String s, int maxolen)
throws IllegalArgumentException { throws IllegalArgumentException {
StringBuffer rs = new StringBuffer(); StringBuffer rs = new StringBuffer();
int off = 0, slen = s.length(), olen = 0; int off = 0, slen = s.length(), olen = 0;
byte ret[]; byte ret[];
@ -513,7 +513,7 @@ public class BCRYPT implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return hashpw(password, salt); return hashpw(password, salt);
} }

View File

@ -1,42 +1,42 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
/** /**
*/ */
public class BCRYPT2Y implements EncryptionMethod { public class BCRYPT2Y implements EncryptionMethod {
/** /**
* Method getHash. * Method getHash.
* *
* @param password String * @param password String
* @param salt String * @param salt String
* @param name String * @param name String
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String) * @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
if (salt.length() == 22) if (salt.length() == 22)
salt = "$2y$10$" + salt; salt = "$2y$10$" + salt;
return (BCRYPT.hashpw(password, salt)); return (BCRYPT.hashpw(password, salt));
} }
/** /**
* Method comparePassword. * Method comparePassword.
* *
* @param hash String * @param hash String
* @param password String * @param password String
* @param playerName String * @param playerName String
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String) * @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
*/ */
@Override @Override
public boolean comparePassword(String hash, String password, public boolean comparePassword(String hash, String password,
String playerName) throws NoSuchAlgorithmException { String playerName) throws NoSuchAlgorithmException {
String ok = hash.substring(0, 29); String ok = hash.substring(0, 29);
if (ok.length() != 29) if (ok.length() != 29)
return false; return false;
return hash.equals(getHash(password, ok, playerName)); return hash.equals(getHash(password, ok, playerName));
} }
} }

View File

@ -36,7 +36,7 @@ public class CRAZYCRYPT1 implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
final String text = "ÜÄaeut//&/=I " + password + "7421€547" + name + "__+IÄIH§%NK " + password; final String text = "ÜÄaeut//&/=I " + password + "7421€547" + name + "__+IÄIH§%NK " + password;
try { try {
final MessageDigest md = MessageDigest.getInstance("SHA-512"); final MessageDigest md = MessageDigest.getInstance("SHA-512");

View File

@ -19,7 +19,7 @@ public class CryptPBKDF2 implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
String result = "pbkdf2_sha256$10000$" + salt + "$"; String result = "pbkdf2_sha256$10000$" + salt + "$";
PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 10000); PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 10000);
PBKDF2Engine engine = new PBKDF2Engine(params); PBKDF2Engine engine = new PBKDF2Engine(params);
@ -46,4 +46,4 @@ public class CryptPBKDF2 implements EncryptionMethod {
return engine.verifyKey(password); return engine.verifyKey(password);
} }
} }

View File

@ -20,7 +20,7 @@ public class CryptPBKDF2Django implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
String result = "pbkdf2_sha256$15000$" + salt + "$"; String result = "pbkdf2_sha256$15000$" + salt + "$";
PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 15000); PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "ASCII", salt.getBytes(), 15000);
PBKDF2Engine engine = new PBKDF2Engine(params); PBKDF2Engine engine = new PBKDF2Engine(params);

View File

@ -15,7 +15,7 @@ public class DOUBLEMD5 implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getMD5(String message) private static String getMD5(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5"); MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset(); md5.reset();
md5.update(message.getBytes()); md5.update(message.getBytes());
@ -33,7 +33,7 @@ public class DOUBLEMD5 implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return getMD5(getMD5(password)); return getMD5(getMD5(password));
} }

View File

@ -27,7 +27,7 @@ public interface EncryptionMethod {
* @return Hashing password * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException * @return Hashing password * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
*/ */
String getHash(String password, String salt, String name) String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException; throws NoSuchAlgorithmException;
/** /**
* @param hash * @param hash
@ -36,6 +36,6 @@ public interface EncryptionMethod {
* @return true if password match, false else * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException * @return true if password match, false else * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
*/ */
boolean comparePassword(String hash, String password, String playerName) boolean comparePassword(String hash, String password, String playerName)
throws NoSuchAlgorithmException; throws NoSuchAlgorithmException;
} }

View File

@ -17,7 +17,7 @@ public class IPB3 implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getMD5(String message) private static String getMD5(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5"); MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset(); md5.reset();
md5.update(message.getBytes()); md5.update(message.getBytes());
@ -35,7 +35,7 @@ public class IPB3 implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return getMD5(getMD5(salt) + getMD5(password)); return getMD5(getMD5(salt) + getMD5(password));
} }

View File

@ -15,7 +15,7 @@ public class JOOMLA implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getMD5(String message) private static String getMD5(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5"); MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset(); md5.reset();
md5.update(message.getBytes()); md5.update(message.getBytes());
@ -33,7 +33,7 @@ public class JOOMLA implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return getMD5(password + salt) + ":" + salt; return getMD5(password + salt) + ":" + salt;
} }

View File

@ -15,7 +15,7 @@ public class MD5 implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getMD5(String message) private static String getMD5(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5"); MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset(); md5.reset();
md5.update(message.getBytes()); md5.update(message.getBytes());
@ -33,7 +33,7 @@ public class MD5 implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return getMD5(password); return getMD5(password);
} }

View File

@ -15,7 +15,7 @@ public class MD5VB implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getMD5(String message) private static String getMD5(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5"); MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset(); md5.reset();
md5.update(message.getBytes()); md5.update(message.getBytes());
@ -33,7 +33,7 @@ public class MD5VB implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return "$MD5vb$" + salt + "$" + getMD5(getMD5(password) + salt); return "$MD5vb$" + salt + "$" + getMD5(getMD5(password) + salt);
} }

View File

@ -17,7 +17,7 @@ public class MYBB implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getMD5(String message) private static String getMD5(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5"); MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset(); md5.reset();
md5.update(message.getBytes()); md5.update(message.getBytes());
@ -35,7 +35,7 @@ public class MYBB implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return getMD5(getMD5(salt) + getMD5(password)); return getMD5(getMD5(salt) + getMD5(password));
} }

View File

@ -214,7 +214,7 @@ public class PHPBB implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return phpbb_hash(password, salt); return phpbb_hash(password, salt);
} }

View File

@ -21,7 +21,7 @@ public class PHPFUSION implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getSHA1(String message) private static String getSHA1(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest sha1 = MessageDigest.getInstance("SHA1"); MessageDigest sha1 = MessageDigest.getInstance("SHA1");
sha1.reset(); sha1.reset();
sha1.update(message.getBytes()); sha1.update(message.getBytes());
@ -39,7 +39,7 @@ public class PHPFUSION implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
String digest = null; String digest = null;
String algo = "HmacSHA256"; String algo = "HmacSHA256";
String keyString = getSHA1(salt); String keyString = getSHA1(salt);

View File

@ -16,7 +16,7 @@ public class PLAINTEXT implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return password; return password;
} }

View File

@ -17,7 +17,7 @@ public class ROYALAUTH implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
for (int i = 0; i < 25; i++) for (int i = 0; i < 25; i++)
password = hash(password, salt); password = hash(password, salt);
return password; return password;
@ -31,7 +31,7 @@ public class ROYALAUTH implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
public String hash(String password, String salt) public String hash(String password, String salt)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("SHA-512"); MessageDigest md = MessageDigest.getInstance("SHA-512");
md.update(password.getBytes()); md.update(password.getBytes());
byte byteData[] = md.digest(); byte byteData[] = md.digest();

View File

@ -17,7 +17,7 @@ public class SALTED2MD5 implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getMD5(String message) private static String getMD5(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5"); MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset(); md5.reset();
md5.update(message.getBytes()); md5.update(message.getBytes());
@ -35,7 +35,7 @@ public class SALTED2MD5 implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return getMD5(getMD5(password) + salt); return getMD5(getMD5(password) + salt);
} }

View File

@ -17,7 +17,7 @@ public class SALTEDSHA512 implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getSHA512(String message) private static String getSHA512(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest sha512 = MessageDigest.getInstance("SHA-512"); MessageDigest sha512 = MessageDigest.getInstance("SHA-512");
sha512.reset(); sha512.reset();
sha512.update(message.getBytes()); sha512.update(message.getBytes());
@ -35,7 +35,7 @@ public class SALTEDSHA512 implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return getSHA512(password + salt); return getSHA512(password + salt);
} }

View File

@ -15,7 +15,7 @@ public class SHA1 implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getSHA1(String message) private static String getSHA1(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest sha1 = MessageDigest.getInstance("SHA1"); MessageDigest sha1 = MessageDigest.getInstance("SHA1");
sha1.reset(); sha1.reset();
sha1.update(message.getBytes()); sha1.update(message.getBytes());
@ -33,7 +33,7 @@ public class SHA1 implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return getSHA1(password); return getSHA1(password);
} }

View File

@ -15,7 +15,7 @@ public class SHA256 implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getSHA256(String message) private static String getSHA256(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest sha256 = MessageDigest.getInstance("SHA-256"); MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
sha256.reset(); sha256.reset();
sha256.update(message.getBytes()); sha256.update(message.getBytes());
@ -33,7 +33,7 @@ public class SHA256 implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return "$SHA$" + salt + "$" + getSHA256(getSHA256(password) + salt); return "$SHA$" + salt + "$" + getSHA256(getSHA256(password) + salt);
} }

View File

@ -15,7 +15,7 @@ public class SHA512 implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getSHA512(String message) private static String getSHA512(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest sha512 = MessageDigest.getInstance("SHA-512"); MessageDigest sha512 = MessageDigest.getInstance("SHA-512");
sha512.reset(); sha512.reset();
sha512.update(message.getBytes()); sha512.update(message.getBytes());
@ -33,7 +33,7 @@ public class SHA512 implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return getSHA512(password); return getSHA512(password);
} }

View File

@ -15,7 +15,7 @@ public class SMF implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getSHA1(String message) private static String getSHA1(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest sha1 = MessageDigest.getInstance("SHA1"); MessageDigest sha1 = MessageDigest.getInstance("SHA1");
sha1.reset(); sha1.reset();
sha1.update(message.getBytes()); sha1.update(message.getBytes());
@ -33,7 +33,7 @@ public class SMF implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return getSHA1(name.toLowerCase() + password); return getSHA1(name.toLowerCase() + password);
} }

View File

@ -17,7 +17,7 @@ public class WBB3 implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @return String * @throws NoSuchAlgorithmException
*/ */
private static String getSHA1(String message) private static String getSHA1(String message)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest sha1 = MessageDigest.getInstance("SHA1"); MessageDigest sha1 = MessageDigest.getInstance("SHA1");
sha1.reset(); sha1.reset();
sha1.update(message.getBytes()); sha1.update(message.getBytes());
@ -35,7 +35,7 @@ public class WBB3 implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return getSHA1(salt.concat(getSHA1(salt.concat(getSHA1(password))))); return getSHA1(salt.concat(getSHA1(salt.concat(getSHA1(password)))));
} }

View File

@ -16,7 +16,7 @@ public class WBB4 implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return BCRYPT.getDoubleHash(password, salt); return BCRYPT.getDoubleHash(password, salt);
} }

View File

@ -2,15 +2,15 @@ package fr.xephi.authme.security.crypts;
/** /**
* The Whirlpool hashing function. * The Whirlpool hashing function.
* <p> * <p/>
* <p> * <p/>
* <b>References</b> * <b>References</b>
* <p> * <p/>
* <p> * <p/>
* The Whirlpool algorithm was developed by <a * The Whirlpool algorithm was developed by <a
* href="mailto:pbarreto@scopus.com.br">Paulo S. L. M. Barreto</a> and <a * href="mailto:pbarreto@scopus.com.br">Paulo S. L. M. Barreto</a> and <a
* href="mailto:vincent.rijmen@cryptomathic.com">Vincent Rijmen</a>. * href="mailto:vincent.rijmen@cryptomathic.com">Vincent Rijmen</a>.
* <p> * <p/>
* See P.S.L.M. Barreto, V. Rijmen, ``The Whirlpool hashing function,'' First * See P.S.L.M. Barreto, V. Rijmen, ``The Whirlpool hashing function,'' First
* NESSIE workshop, 2000 (tweaked version, 2003), * NESSIE workshop, 2000 (tweaked version, 2003),
* <https://www.cosic.esat.kuleuven * <https://www.cosic.esat.kuleuven
@ -19,33 +19,33 @@ package fr.xephi.authme.security.crypts;
* @author Paulo S.L.M. Barreto * @author Paulo S.L.M. Barreto
* @author Vincent Rijmen. * @author Vincent Rijmen.
* @version 3.0 (2003.03.12) * @version 3.0 (2003.03.12)
* <p> * <p/>
* ==================================================================== * ====================================================================
* ========= * =========
* <p> * <p/>
* Differences from version 2.1: * Differences from version 2.1:
* <p> * <p/>
* - Suboptimal diffusion matrix replaced by cir(1, 1, 4, 1, 8, 5, 2, * - Suboptimal diffusion matrix replaced by cir(1, 1, 4, 1, 8, 5, 2,
* 9). * 9).
* <p> * <p/>
* ==================================================================== * ====================================================================
* ========= * =========
* <p> * <p/>
* Differences from version 2.0: * Differences from version 2.0:
* <p> * <p/>
* - Generation of ISO/IEC 10118-3 test vectors. - Bug fix: nonzero * - Generation of ISO/IEC 10118-3 test vectors. - Bug fix: nonzero
* carry was ignored when tallying the data length (this bug apparently * carry was ignored when tallying the data length (this bug apparently
* only manifested itself when feeding data in pieces rather than in a * only manifested itself when feeding data in pieces rather than in a
* single chunk at once). * single chunk at once).
* <p> * <p/>
* Differences from version 1.0: * Differences from version 1.0:
* <p> * <p/>
* - Original S-box replaced by the tweaked, hardware-efficient * - Original S-box replaced by the tweaked, hardware-efficient
* version. * version.
* <p> * <p/>
* ==================================================================== * ====================================================================
* ========= * =========
* <p> * <p/>
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -401,7 +401,7 @@ public class WHIRLPOOL implements EncryptionMethod {
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String) */ * @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String) */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
byte[] digest = new byte[DIGESTBYTES]; byte[] digest = new byte[DIGESTBYTES];
NESSIEinit(); NESSIEinit();
NESSIEadd(password); NESSIEadd(password);

View File

@ -137,7 +137,7 @@ public class WORDPRESS implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
byte random[] = new byte[6]; byte random[] = new byte[6];
this.randomGen.nextBytes(random); this.randomGen.nextBytes(random);
return crypt(password, gensaltPrivate(stringToUtf8(new String(random)))); return crypt(password, gensaltPrivate(stringToUtf8(new String(random))));

View File

@ -31,7 +31,7 @@ public class XAUTH implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
String hash = getWhirlpool(salt + password).toLowerCase(); String hash = getWhirlpool(salt + password).toLowerCase();
int saltPos = (password.length() >= hash.length() ? hash.length() - 1 : password.length()); int saltPos = (password.length() >= hash.length() ? hash.length() - 1 : password.length());
return hash.substring(0, saltPos) + salt + hash.substring(saltPos); return hash.substring(0, saltPos) + salt + hash.substring(saltPos);

View File

@ -23,7 +23,7 @@ public class XF implements EncryptionMethod {
*/ */
@Override @Override
public String getHash(String password, String salt, String name) public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
return getSHA256(getSHA256(password) + regmatch("\"salt\";.:..:\"(.*)\";.:.:\"hashFunc\"", salt)); return getSHA256(getSHA256(password) + regmatch("\"salt\";.:..:\"(.*)\";.:.:\"hashFunc\"", salt));
} }

View File

@ -115,7 +115,7 @@ public class PBKDF2Engine implements PBKDF2 {
* ISO-8559-1 encoding. Output result as * ISO-8559-1 encoding. Output result as
* &quot;Salt:iteration-count:PBKDF2&quot; with binary data in hexadecimal * &quot;Salt:iteration-count:PBKDF2&quot; with binary data in hexadecimal
* encoding. * encoding.
* <p> * <p/>
* Example: Password &quot;password&quot; (without the quotes) leads to * Example: Password &quot;password&quot; (without the quotes) leads to
* 48290A0B96C426C3:1000:973899B1D4AFEB3ED371060D0797E0EE0142BD04 * 48290A0B96C426C3:1000:973899B1D4AFEB3ED371060D0797E0EE0142BD04
* *
@ -123,7 +123,7 @@ public class PBKDF2Engine implements PBKDF2 {
* @throws IOException * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException * @throws IOException * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
*/ */
public static void main(String[] args) public static void main(String[] args)
throws IOException, NoSuchAlgorithmException { throws IOException, NoSuchAlgorithmException {
String password = "password"; String password = "password";
String candidate = null; String candidate = null;
PBKDF2Formatter formatter = new PBKDF2HexFormatter(); PBKDF2Formatter formatter = new PBKDF2HexFormatter();

View File

@ -48,46 +48,46 @@ public final class Settings extends YamlConfiguration {
// Due to compatibility issues with plugins like FactionsChat // Due to compatibility issues with plugins like FactionsChat
public static Boolean isChatAllowed; public static Boolean isChatAllowed;
public static boolean isPermissionCheckEnabled, isRegistrationEnabled, public static boolean isPermissionCheckEnabled, isRegistrationEnabled,
isForcedRegistrationEnabled, isTeleportToSpawnEnabled, isForcedRegistrationEnabled, isTeleportToSpawnEnabled,
isSessionsEnabled, isAllowRestrictedIp, isSessionsEnabled, isAllowRestrictedIp,
isMovementAllowed, isKickNonRegisteredEnabled, isMovementAllowed, isKickNonRegisteredEnabled,
isForceSingleSessionEnabled, isForceSpawnLocOnJoinEnabled, isForceSingleSessionEnabled, isForceSpawnLocOnJoinEnabled,
isSaveQuitLocationEnabled, isForceSurvivalModeEnabled, isSaveQuitLocationEnabled, isForceSurvivalModeEnabled,
isResetInventoryIfCreative, isCachingEnabled, isResetInventoryIfCreative, isCachingEnabled,
isKickOnWrongPasswordEnabled, getEnablePasswordVerifier, isKickOnWrongPasswordEnabled, getEnablePasswordVerifier,
protectInventoryBeforeLogInEnabled, isBackupActivated, protectInventoryBeforeLogInEnabled, isBackupActivated,
isBackupOnStart, isBackupOnStop, isStopEnabled, reloadSupport, isBackupOnStart, isBackupOnStop, isStopEnabled, reloadSupport,
rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts, rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts,
useCaptcha, emailRegistration, multiverse, bungee, useCaptcha, emailRegistration, multiverse, bungee,
banUnsafeIp, doubleEmailCheck, sessionExpireOnIpChange, banUnsafeIp, doubleEmailCheck, sessionExpireOnIpChange,
disableSocialSpy, forceOnlyAfterLogin, useEssentialsMotd, usePurge, disableSocialSpy, forceOnlyAfterLogin, useEssentialsMotd, usePurge,
purgePlayerDat, purgeEssentialsFile, supportOldPassword, purgePlayerDat, purgeEssentialsFile, supportOldPassword,
purgeLimitedCreative, purgeAntiXray, purgePermissions, purgeLimitedCreative, purgeAntiXray, purgePermissions,
enableProtection, enableAntiBot, recallEmail, useWelcomeMessage, enableProtection, enableAntiBot, recallEmail, useWelcomeMessage,
broadcastWelcomeMessage, forceRegKick, forceRegLogin, broadcastWelcomeMessage, forceRegKick, forceRegLogin,
checkVeryGames, delayJoinLeaveMessages, noTeleport, applyBlindEffect, checkVeryGames, delayJoinLeaveMessages, noTeleport, applyBlindEffect,
customAttributes, generateImage, isRemoveSpeedEnabled, isMySQLWebsite; customAttributes, generateImage, isRemoveSpeedEnabled, isMySQLWebsite;
public static String getNickRegex, getUnloggedinGroup, getMySQLHost, public static String getNickRegex, getUnloggedinGroup, getMySQLHost,
getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase, getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase,
getMySQLTablename, getMySQLColumnName, getMySQLColumnPassword, getMySQLTablename, getMySQLColumnName, getMySQLColumnPassword,
getMySQLColumnIp, getMySQLColumnLastLogin, getMySQLColumnSalt, getMySQLColumnIp, getMySQLColumnLastLogin, getMySQLColumnSalt,
getMySQLColumnGroup, getMySQLColumnEmail, unRegisteredGroup, getMySQLColumnGroup, getMySQLColumnEmail, unRegisteredGroup,
backupWindowsPath, getRegisteredGroup, backupWindowsPath, getRegisteredGroup,
messagesLanguage, getMySQLlastlocX, getMySQLlastlocY, messagesLanguage, getMySQLlastlocX, getMySQLlastlocY,
getMySQLlastlocZ, rakamakUsers, rakamakUsersIp, getmailAccount, getMySQLlastlocZ, rakamakUsers, rakamakUsersIp, getmailAccount,
getmailPassword, getmailSMTP, getMySQLColumnId, getmailSenderName, getmailPassword, getmailSMTP, getMySQLColumnId, getmailSenderName,
getMailSubject, getMailText, getMySQLlastlocWorld, defaultWorld, getMailSubject, getMailText, getMySQLlastlocWorld, defaultWorld,
getPhpbbPrefix, getWordPressPrefix, getMySQLColumnLogged, getPhpbbPrefix, getWordPressPrefix, getMySQLColumnLogged,
spawnPriority, crazyloginFileName, getPassRegex, spawnPriority, crazyloginFileName, getPassRegex,
getMySQLColumnRealName; getMySQLColumnRealName;
public static int getWarnMessageInterval, getSessionTimeout, public static int getWarnMessageInterval, getSessionTimeout,
getRegistrationTimeout, getMaxNickLength, getMinNickLength, getRegistrationTimeout, getMaxNickLength, getMinNickLength,
getPasswordMinLen, getMovementRadius, getmaxRegPerIp, getPasswordMinLen, getMovementRadius, getmaxRegPerIp,
getNonActivatedGroup, passwordMaxLength, getRecoveryPassLength, getNonActivatedGroup, passwordMaxLength, getRecoveryPassLength,
getMailPort, maxLoginTry, captchaLength, saltLength, getMailPort, maxLoginTry, captchaLength, saltLength,
getmaxRegPerEmail, bCryptLog2Rounds, getPhpbbGroup, getmaxRegPerEmail, bCryptLog2Rounds, getPhpbbGroup,
antiBotSensibility, antiBotDuration, delayRecall, getMaxLoginPerIp, antiBotSensibility, antiBotDuration, delayRecall, getMaxLoginPerIp,
getMaxJoinPerIp, getMySQLMaxConnections; getMaxJoinPerIp, getMySQLMaxConnections;
protected static YamlConfiguration configFile; protected static YamlConfiguration configFile;
private static AuthMe plugin; private static AuthMe plugin;
private static Settings instance; private static Settings instance;
@ -480,7 +480,7 @@ public final class Settings extends YamlConfiguration {
changes = true; changes = true;
} }
if (configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA1") || if (configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA1") ||
configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA256")) { configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA256")) {
set("settings.security.passwordHash", "XENFORO"); set("settings.security.passwordHash", "XENFORO");
changes = true; changes = true;
} }
@ -685,7 +685,7 @@ public final class Settings extends YamlConfiguration {
/** /**
* Saves current configuration (plus defaults) to disk. * Saves current configuration (plus defaults) to disk.
* <p> * <p/>
* If defaults and configuration are empty, saves blank file. * If defaults and configuration are empty, saves blank file.
* *
* @return True if saved successfully * @return True if saved successfully

View File

@ -13,7 +13,7 @@ import java.util.zip.GZIPInputStream;
public class GeoLiteAPI { public class GeoLiteAPI {
private static final String GEOIP_URL = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry" + private static final String GEOIP_URL = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry" +
"/GeoIP.dat.gz"; "/GeoIP.dat.gz";
private static final AuthMe plugin = AuthMe.getInstance(); private static final AuthMe plugin = AuthMe.getInstance();
private static LookupService lookupService; private static LookupService lookupService;
@ -31,7 +31,7 @@ public class GeoLiteAPI {
try { try {
lookupService = new LookupService(data); lookupService = new LookupService(data);
plugin.getLogger().info("[LICENSE] This product uses data from the GeoLite API created by MaxMind, " + plugin.getLogger().info("[LICENSE] This product uses data from the GeoLite API created by MaxMind, " +
"available at http://www.maxmind.com"); "available at http://www.maxmind.com");
return true; return true;
} catch (IOException e) { } catch (IOException e) {
return false; return false;

View File

@ -58,7 +58,7 @@ public final class Utils {
try { try {
lookupService = new LookupService(data); lookupService = new LookupService(data);
ConsoleLogger.info("[LICENSE] This product uses data from the GeoLite API created by MaxMind, " + ConsoleLogger.info("[LICENSE] This product uses data from the GeoLite API created by MaxMind, " +
"available at http://www.maxmind.com"); "available at http://www.maxmind.com");
return true; return true;
} catch (IOException e) { } catch (IOException e) {
return false; return false;
@ -154,7 +154,7 @@ public final class Utils {
/** /**
* TODO: This method requires better explanation. * TODO: This method requires better explanation.
* <p> * <p/>
* Set the normal group of a player. * Set the normal group of a player.
* *
* @param player The player. * @param player The player.
@ -200,7 +200,7 @@ public final class Utils {
public static boolean isUnrestricted(Player player) { public static boolean isUnrestricted(Player player) {
return Settings.isAllowRestrictedIp && !Settings.getUnrestrictedName.isEmpty() return Settings.isAllowRestrictedIp && !Settings.getUnrestrictedName.isEmpty()
&& (Settings.getUnrestrictedName.contains(player.getName())); && (Settings.getUnrestrictedName.contains(player.getName()));
} }
/** /**
@ -302,7 +302,7 @@ public final class Utils {
} }
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
ConsoleLogger.showError("Could not retrieve list of online players: [" ConsoleLogger.showError("Could not retrieve list of online players: ["
+ e.getClass().getName() + "] " + e.getMessage()); + e.getClass().getName() + "] " + e.getMessage());
} }
return Collections.emptyList(); return Collections.emptyList();
} }
@ -333,8 +333,8 @@ public final class Utils {
if (player.hasMetadata("NPC")) { if (player.hasMetadata("NPC")) {
return true; return true;
} else if (plugin.combatTagPlus != null } else if (plugin.combatTagPlus != null
&& player instanceof Player && player instanceof Player
&& plugin.combatTagPlus.getNpcPlayerHelper().isNpc((Player) player)) { && plugin.combatTagPlus.getNpcPlayerHelper().isNpc((Player) player)) {
return true; return true;
} }
return false; return false;