Reformat MapleClient

Now uses 4 space indentation
This commit is contained in:
P0nk
2021-06-08 19:32:06 +02:00
parent eb7ee9dabe
commit 4dc0935391

View File

@@ -51,8 +51,8 @@ import tools.*;
import javax.script.ScriptEngine; import javax.script.ScriptEngine;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress; import java.net.InetAddress;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.sql.*; import java.sql.*;
@@ -615,7 +615,7 @@ public class MapleClient {
int len = convert.length(); int len = convert.length();
for (int i = len - 2; i >= 0; i -= 2) { for (int i = len - 2; i >= 0; i -= 2) {
hwid.append(convert.substring(i, i + 2)); hwid.append(convert, i, i + 2);
} }
hwid.insert(4, "-"); hwid.insert(4, "-");
@@ -888,7 +888,9 @@ public class MapleClient {
player.saveCharToDB(true); player.saveCharToDB(true);
player.logOff(); player.logOff();
if(YamlConfig.config.server.INSTANT_NAME_CHANGE) player.doPendingNameChange(); if (YamlConfig.config.server.INSTANT_NAME_CHANGE) {
player.doPendingNameChange();
}
clear(); clear();
} else { } else {
getChannelServer().removePlayer(player); getChannelServer().removePlayer(player);
@@ -1201,9 +1203,9 @@ public class MapleClient {
private static boolean checkHash(String hash, String type, String password) { private static boolean checkHash(String hash, String type, String password) {
try { try {
MessageDigest digester = MessageDigest.getInstance(type); MessageDigest digester = MessageDigest.getInstance(type);
digester.update(password.getBytes("UTF-8"), 0, password.length()); digester.update(password.getBytes(StandardCharsets.UTF_8), 0, password.length());
return HexTool.toString(digester.digest()).replace(" ", "").toLowerCase().equals(hash); return HexTool.toString(digester.digest()).replace(" ", "").toLowerCase().equals(hash);
} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) { } catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Encoding the string failed", e); throw new RuntimeException("Encoding the string failed", e);
} }
} }