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; return true;
} }
// Enable the mod if(newState != null) {
if (newState.equalsIgnoreCase("ON")) { // Enable the mod
AntiBot.overrideAntiBotStatus(true); if (newState.equalsIgnoreCase("ON")) {
sender.sendMessage("[AuthMe] AntiBot Manual Ovverride: enabled!"); AntiBot.overrideAntiBotStatus(true);
return true; sender.sendMessage("[AuthMe] AntiBot Manual Override: enabled!");
} return true;
}
// Disable the mod // Disable the mod
if (newState.equalsIgnoreCase("OFF")) { if (newState.equalsIgnoreCase("OFF")) {
AntiBot.overrideAntiBotStatus(false); AntiBot.overrideAntiBotStatus(false);
sender.sendMessage("[AuthMe] AntiBotMod Manual Ovverride: disabled!"); sender.sendMessage("[AuthMe] AntiBotMod Manual Override: disabled!");
return true; return true;
}
} }
// Show the invalid arguments warning // Show the invalid arguments warning

View File

@ -9,7 +9,6 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.Scanner; import java.util.Scanner;
import java.util.UUID; import java.util.UUID;
@ -35,8 +34,6 @@ public class vAuthFileReader {
/** /**
* Method convert. * Method convert.
*
* @throws IOException
*/ */
public void convert() { public void convert() {
final File file = new File(plugin.getDataFolder().getParent() + "" + File.separator + "vAuth" + File.separator + "passwords.yml"); 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; BufferedReader br = null;
try { try {
br = new BufferedReader(new FileReader(source)); br = new BufferedReader(new FileReader(source));
String line = ""; String line;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
String[] args = line.split(":"); String[] args = line.split(":");
if (args[0].equals(auth.getNickname())) { if (args[0].equals(auth.getNickname())) {

View File

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

View File

@ -36,9 +36,7 @@ public class BCRYPT2Y implements EncryptionMethod {
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) return ok.length() == 29 && hash.equals(getHash(password, ok, playerName));
return false;
return 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]; L[i] ^= C[t][(int) (K[(i - t) & 7] >>> s) & 0xff];
} }
} }
for (int i = 0; i < 8; i++) { System.arraycopy(L, 0, K, 0, 8);
K[i] = L[i];
}
K[0] ^= rc[r]; K[0] ^= rc[r];
/* /*
* apply the r-th round transformation: * 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]; L[i] ^= C[t][(int) (state[(i - t) & 7] >>> s) & 0xff];
} }
} }
for (int i = 0; i < 8; i++) { System.arraycopy(L, 0, state, 0, 8);
state[i] = L[i];
}
} }
/* /*
* apply the Miyaguchi-Preneel compression function: * 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.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/**
*/
public class XF implements EncryptionMethod { public class XF implements EncryptionMethod {
/** /**
@ -55,10 +53,6 @@ public class XF implements EncryptionMethod {
MessageDigest md = MessageDigest.getInstance("SHA-256"); MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(password.getBytes()); md.update(password.getBytes());
byte byteData[] = md.digest(); 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(); StringBuilder hexString = new StringBuilder();
for (byte element : byteData) { for (byte element : byteData) {
String hex = Integer.toHexString(0xff & element); String hex = Integer.toHexString(0xff & element);

View File

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