This commit is contained in:
Gabriele C 2015-11-25 15:37:06 +01:00
parent ea0e65df55
commit 6dc4119d0c
8 changed files with 22 additions and 36 deletions

View File

@ -31,18 +31,19 @@ public class SwitchAntiBotCommand extends ExecutableCommand {
return true;
}
// Enable the mod
if (newState.equalsIgnoreCase("ON")) {
AntiBot.overrideAntiBotStatus(true);
sender.sendMessage("[AuthMe] AntiBot Manual Ovverride: enabled!");
return true;
}
// Disable the mod
if (newState.equalsIgnoreCase("OFF")) {
AntiBot.overrideAntiBotStatus(false);
sender.sendMessage("[AuthMe] AntiBotMod Manual Ovverride: disabled!");
return true;
if(newState != null) {
// Enable the mod
if (newState.equalsIgnoreCase("ON")) {
AntiBot.overrideAntiBotStatus(true);
sender.sendMessage("[AuthMe] AntiBot Manual Override: enabled!");
return true;
}
// Disable the mod
if (newState.equalsIgnoreCase("OFF")) {
AntiBot.overrideAntiBotStatus(false);
sender.sendMessage("[AuthMe] AntiBotMod Manual Override: disabled!");
return true;
}
}
// Show the invalid arguments warning

View File

@ -9,7 +9,6 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
import java.util.UUID;
@ -35,8 +34,6 @@ public class vAuthFileReader {
/**
* Method convert.
*
* @throws IOException
*/
public void convert() {
final File file = new File(plugin.getDataFolder().getParent() + "" + File.separator + "vAuth" + File.separator + "passwords.yml");

View File

@ -564,7 +564,7 @@ public class FlatFile implements DataSource {
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(source));
String line = "";
String line;
while ((line = br.readLine()) != null) {
String[] args = line.split(":");
if (args[0].equals(auth.getNickname())) {

View File

@ -46,7 +46,7 @@ public class MySQL implements DataSource {
*
* @throws ClassNotFoundException * @throws SQLException * @throws PoolInitializationException
*/
public MySQL() throws ClassNotFoundException, SQLException, PoolInitializationException {
public MySQL() throws SQLException, PoolInitializationException {
this.host = Settings.getMySQLHost;
this.port = Settings.getMySQLPort;
this.username = Settings.getMySQLUsername;
@ -102,7 +102,7 @@ public class MySQL implements DataSource {
/**
* Method setConnectionArguments.
*
* @throws ClassNotFoundException * @throws IllegalArgumentException
* @throws IllegalArgumentException
*/
private synchronized void setConnectionArguments()
throws IllegalArgumentException {
@ -126,10 +126,10 @@ public class MySQL implements DataSource {
/**
* Method reloadArguments.
*
* @throws ClassNotFoundException * @throws IllegalArgumentException
* @throws IllegalArgumentException
*/
private synchronized void reloadArguments()
throws ClassNotFoundException, IllegalArgumentException {
throws IllegalArgumentException {
if (ds != null) {
ds.close();
}

View File

@ -36,9 +36,7 @@ public class BCRYPT2Y implements EncryptionMethod {
public boolean comparePassword(String hash, String password,
String playerName) throws NoSuchAlgorithmException {
String ok = hash.substring(0, 29);
if (ok.length() != 29)
return false;
return hash.equals(getHash(password, ok, playerName));
return ok.length() == 29 && hash.equals(getHash(password, ok, playerName));
}
}

View File

@ -211,9 +211,7 @@ public class WHIRLPOOL implements EncryptionMethod {
L[i] ^= C[t][(int) (K[(i - t) & 7] >>> s) & 0xff];
}
}
for (int i = 0; i < 8; i++) {
K[i] = L[i];
}
System.arraycopy(L, 0, K, 0, 8);
K[0] ^= rc[r];
/*
* apply the r-th round transformation:
@ -224,9 +222,7 @@ public class WHIRLPOOL implements EncryptionMethod {
L[i] ^= C[t][(int) (state[(i - t) & 7] >>> s) & 0xff];
}
}
for (int i = 0; i < 8; i++) {
state[i] = L[i];
}
System.arraycopy(L, 0, state, 0, 8);
}
/*
* apply the Miyaguchi-Preneel compression function:

View File

@ -9,8 +9,6 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*/
public class XF implements EncryptionMethod {
/**
@ -55,10 +53,6 @@ public class XF implements EncryptionMethod {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(password.getBytes());
byte byteData[] = md.digest();
StringBuilder sb = new StringBuilder();
for (byte element : byteData) {
sb.append(Integer.toString((element & 0xff) + 0x100, 16).substring(1));
}
StringBuilder hexString = new StringBuilder();
for (byte element : byteData) {
String hex = Integer.toHexString(0xff & element);

View File

@ -46,7 +46,7 @@ public class BinTools {
if (b == null) {
return "";
}
StringBuffer stringBuffer = new StringBuffer(2 * b.length);
StringBuilder stringBuffer = new StringBuilder(2 * b.length);
for (byte aB : b) {
int v = (256 + aB) % 256;
stringBuffer.append(hex.charAt((v / 16) & 15));