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 {
Files.write(Settings.LOG_FILE.toPath(), (dateTime + ": " + message + StringUtils.newline).getBytes(),
StandardOpenOption.APPEND,
StandardOpenOption.CREATE);
StandardOpenOption.APPEND,
StandardOpenOption.CREATE);
} 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.
*/
private static final String[] COMMANDS_TO_SKIP = {"/login ", "/l ", "/reg ", "/changepassword ",
"/unregister ", "/authme register ", "/authme changepassword ", "/authme reg ", "/authme cp ",
"/register "};
"/unregister ", "/authme register ", "/authme changepassword ", "/authme reg ", "/authme cp ",
"/register "};
/**
* Constructor.
@ -57,7 +57,7 @@ public class Log4JFilter implements org.apache.logging.log4j.core.Filter {
String lowerMessage = message.toLowerCase();
if (lowerMessage.contains("issued server command:")
&& StringUtils.containsAny(lowerMessage, COMMANDS_TO_SKIP)) {
&& StringUtils.containsAny(lowerMessage, COMMANDS_TO_SKIP)) {
return Result.DENY;
}
return Result.NEUTRAL;

View File

@ -38,7 +38,7 @@ public class PerformBackup {
* @param cause BackupCause The cause of the backup.
*/
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());
}
// Check whether a backup should be made at the specified point in time

View File

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

View File

@ -25,10 +25,10 @@ public class JsonCache {
ConsoleLogger.showError("Failed to create cache directory.");
}
gson = new GsonBuilder()
.registerTypeAdapter(DataFileCache.class, new PlayerDataSerializer())
.registerTypeAdapter(DataFileCache.class, new PlayerDataDeserializer())
.setPrettyPrinting()
.create();
.registerTypeAdapter(DataFileCache.class, new PlayerDataSerializer())
.registerTypeAdapter(DataFileCache.class, new PlayerDataDeserializer())
.setPrettyPrinting()
.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
if (queryReference.getCount() <= getParentCount() + 1)
return new FoundCommandResult(
this,
getCommandReference(queryReference),
new CommandParts(),
queryReference);
this,
getCommandReference(queryReference),
new CommandParts(),
queryReference);
// Get the new command reference and arguments
CommandParts newReference = new CommandParts(queryReference.getRange(0, getParentCount() + 1));
@ -798,8 +798,8 @@ public class CommandDescription {
@Override
public int compare(CommandDescription o1, CommandDescription o2) {
return Double.compare(
o1.getCommandDifference(queryReference),
o2.getCommandDifference(queryReference));
o1.getCommandDifference(queryReference),
o2.getCommandDifference(queryReference));
}
});

View File

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

View File

@ -29,13 +29,13 @@ public final class HelpSyntaxHelper {
String alternativeLabel, boolean highlight) {
// Create a string builder with white color and prefixed slash
StringBuilder sb = new StringBuilder()
.append(ChatColor.WHITE)
.append("/");
.append(ChatColor.WHITE)
.append("/");
// Get the help command reference, and the command label
CommandParts helpCommandReference = commandDescription.getCommandReference(commandReference);
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
String commandLabel;
@ -47,9 +47,9 @@ public final class HelpSyntaxHelper {
// Show the important bit of the command, highlight this part if required
sb.append(parentCommand)
.append(" ")
.append(highlight ? ChatColor.YELLOW.toString() + ChatColor.BOLD : "")
.append(commandLabel);
.append(" ")
.append(highlight ? ChatColor.YELLOW.toString() + ChatColor.BOLD : "")
.append(commandLabel);
if (highlight) {
sb.append(ChatColor.YELLOW);

View File

@ -105,7 +105,7 @@ public class MySQL implements DataSource {
* @throws ClassNotFoundException * @throws IllegalArgumentException
*/
private synchronized void setConnectionArguments()
throws ClassNotFoundException, IllegalArgumentException {
throws ClassNotFoundException, IllegalArgumentException {
HikariConfig config = new HikariConfig();
config.setPoolName("AuthMeMYSQLPool");
config.setDriverClassName("com.mysql.jdbc.Driver");
@ -129,7 +129,7 @@ public class MySQL implements DataSource {
* @throws ClassNotFoundException * @throws IllegalArgumentException
*/
private synchronized void reloadArguments()
throws ClassNotFoundException, IllegalArgumentException {
throws ClassNotFoundException, IllegalArgumentException {
if (ds != null) {
ds.close();
}

View File

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

View File

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

View File

@ -248,7 +248,7 @@ public class AsyncronousJoin {
}
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));
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgTask);
}
@ -306,7 +306,7 @@ public class AsyncronousJoin {
Material cur = player.getLocation().getBlock().getType();
Material top = player.getLocation().add(0D, 1D, 0D).getBlock().getType();
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");
player.teleport(spawnLoc);
}

View File

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

View File

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

View File

@ -16,7 +16,7 @@ public class BCRYPT2Y implements EncryptionMethod {
*/
@Override
public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException {
throws NoSuchAlgorithmException {
if (salt.length() == 22)
salt = "$2y$10$" + salt;
return (BCRYPT.hashpw(password, salt));

View File

@ -36,7 +36,7 @@ public class CRAZYCRYPT1 implements EncryptionMethod {
*/
@Override
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;
try {
final MessageDigest md = MessageDigest.getInstance("SHA-512");

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ public interface EncryptionMethod {
* @return Hashing password * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
*/
String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException;
throws NoSuchAlgorithmException;
/**
* @param hash
@ -36,6 +36,6 @@ public interface EncryptionMethod {
* @return true if password match, false else * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
*/
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
*/
private static String getMD5(String message)
throws NoSuchAlgorithmException {
throws NoSuchAlgorithmException {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset();
md5.update(message.getBytes());
@ -35,7 +35,7 @@ public class IPB3 implements EncryptionMethod {
*/
@Override
public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException {
throws NoSuchAlgorithmException {
return getMD5(getMD5(salt) + getMD5(password));
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ public class XF implements EncryptionMethod {
*/
@Override
public String getHash(String password, String salt, String name)
throws NoSuchAlgorithmException {
throws NoSuchAlgorithmException {
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
* &quot;Salt:iteration-count:PBKDF2&quot; with binary data in hexadecimal
* encoding.
* <p>
* <p/>
* Example: Password &quot;password&quot; (without the quotes) leads to
* 48290A0B96C426C3:1000:973899B1D4AFEB3ED371060D0797E0EE0142BD04
*
@ -123,7 +123,7 @@ public class PBKDF2Engine implements PBKDF2 {
* @throws IOException * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
*/
public static void main(String[] args)
throws IOException, NoSuchAlgorithmException {
throws IOException, NoSuchAlgorithmException {
String password = "password";
String candidate = null;
PBKDF2Formatter formatter = new PBKDF2HexFormatter();

View File

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

View File

@ -13,7 +13,7 @@ import java.util.zip.GZIPInputStream;
public class GeoLiteAPI {
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 LookupService lookupService;
@ -31,7 +31,7 @@ public class GeoLiteAPI {
try {
lookupService = new LookupService(data);
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;
} catch (IOException e) {
return false;

View File

@ -58,7 +58,7 @@ public final class Utils {
try {
lookupService = new LookupService(data);
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;
} catch (IOException e) {
return false;
@ -154,7 +154,7 @@ public final class Utils {
/**
* TODO: This method requires better explanation.
* <p>
* <p/>
* Set the normal group of a player.
*
* @param player The player.
@ -200,7 +200,7 @@ public final class Utils {
public static boolean isUnrestricted(Player player) {
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) {
ConsoleLogger.showError("Could not retrieve list of online players: ["
+ e.getClass().getName() + "] " + e.getMessage());
+ e.getClass().getName() + "] " + e.getMessage());
}
return Collections.emptyList();
}
@ -333,8 +333,8 @@ public final class Utils {
if (player.hasMetadata("NPC")) {
return true;
} else if (plugin.combatTagPlus != null
&& player instanceof Player
&& plugin.combatTagPlus.getNpcPlayerHelper().isNpc((Player) player)) {
&& player instanceof Player
&& plugin.combatTagPlus.getNpcPlayerHelper().isNpc((Player) player)) {
return true;
}
return false;