Fix all warnings

Add and make use of Lombok
Remove Mojang API
Remove ZipFileUtils
Remove StreamTools in favor of Apache IOUtils
Keyframe should be abstract all derivatives final
Replace clone in Keyframe with copy
Move some constants from GuiReplaySetttings to GuiConstants
This commit is contained in:
johni0702
2015-06-29 21:45:37 +02:00
parent 3122c0a71e
commit a058497727
110 changed files with 487 additions and 1921 deletions

View File

@@ -31,6 +31,7 @@ public class AuthenticationHandler {
}
public static String getUsername() { return username; }
@SuppressWarnings("unused")
public static boolean hasDonated(String uuid) throws IOException, ApiException {
return apiClient.hasDonated(uuid);
}
@@ -42,12 +43,12 @@ public class AuthenticationHandler {
AuthKey auth = apiClient.register(usrname, mail, password,
mc.getSession().getProfile().getId().toString());
username = usrname;
authkey = auth.getAuthkey();
authkey = auth.getAuth();
saveAuthkey(authkey);
}
public static void loadAuthkeyFromConfig() {
Property p = ReplayMod.instance.config.get("authkey", "authkey", "null");
Property p = ReplayMod.config.get("authkey", "authkey", "null");
String key = null;
if(!(p.getString().equals("null"))) {
@@ -68,7 +69,7 @@ public class AuthenticationHandler {
public static int authenticate(String usrname, String password) {
try {
authkey = ReplayMod.apiClient.getLogin(usrname, password).getAuthkey();
authkey = ReplayMod.apiClient.getLogin(usrname, password).getAuth();
username = usrname;
saveAuthkey(authkey);
return SUCCESS;
@@ -94,8 +95,8 @@ public class AuthenticationHandler {
}
private static void saveAuthkey(String authkey) {
ReplayMod.instance.config.removeCategory(ReplayMod.config.getCategory("authkey"));
ReplayMod.instance.config.get("authkey", "authkey", authkey);
ReplayMod.instance.config.save();
ReplayMod.config.removeCategory(ReplayMod.config.getCategory("authkey"));
ReplayMod.config.get("authkey", "authkey", authkey);
ReplayMod.config.save();
}
}

View File

@@ -21,19 +21,14 @@ public class AuthenticationHash {
public final String hash;
private String getAuthenticationHash() {
StringBuilder builder = new StringBuilder();
builder.append(username);
builder.append(currentTime);
builder.append(randomLong);
String md5 = builder.toString();
String md5 = username + currentTime + randomLong;
try {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
byte[] array = md.digest(md5.getBytes());
StringBuffer sb = new StringBuffer();
for (int i = 0; i < array.length; ++i) {
sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1,3));
StringBuilder sb = new StringBuilder();
for (byte b : array) {
sb.append(Integer.toHexString((b & 0xFF) | 0x100).substring(1, 3));
}
return sb.toString();
} catch (java.security.NoSuchAlgorithmException e) {