Reformat MapleClient
Now uses 4 space indentation
This commit is contained in:
@@ -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.*;
|
||||||
@@ -240,7 +240,7 @@ public class MapleClient {
|
|||||||
voteTime = -1;
|
voteTime = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasVotedAlready(){
|
public boolean hasVotedAlready() {
|
||||||
Date currentDate = new Date();
|
Date currentDate = new Date();
|
||||||
int timeNow = (int) (currentDate.getTime() / 1000);
|
int timeNow = (int) (currentDate.getTime() / 1000);
|
||||||
int difference = (timeNow - getVoteTime());
|
int difference = (timeNow - getVoteTime());
|
||||||
@@ -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, "-");
|
||||||
|
|
||||||
@@ -795,7 +795,7 @@ public class MapleClient {
|
|||||||
if (player.getMap() != null) {
|
if (player.getMap() != null) {
|
||||||
int mapId = player.getMapId();
|
int mapId = player.getMapId();
|
||||||
player.getMap().removePlayer(player);
|
player.getMap().removePlayer(player);
|
||||||
if(GameConstants.isDojo(mapId)) {
|
if (GameConstants.isDojo(mapId)) {
|
||||||
this.getChannelServer().freeDojoSectionIfEmpty(mapId);
|
this.getChannelServer().freeDojoSectionIfEmpty(mapId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -877,7 +877,7 @@ public class MapleClient {
|
|||||||
FilePrinter.printError(FilePrinter.ACCOUNT_STUCK, e);
|
FilePrinter.printError(FilePrinter.ACCOUNT_STUCK, e);
|
||||||
} finally {
|
} finally {
|
||||||
if (!this.serverTransition) {
|
if (!this.serverTransition) {
|
||||||
if(chrg != null) {
|
if (chrg != null) {
|
||||||
chrg.setCharacter(null);
|
chrg.setCharacter(null);
|
||||||
}
|
}
|
||||||
wserv.removePlayer(player);
|
wserv.removePlayer(player);
|
||||||
@@ -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);
|
||||||
@@ -977,7 +979,7 @@ public class MapleClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return MapleCharacter.deleteCharFromDB(chr, senderAccId);
|
return MapleCharacter.deleteCharFromDB(chr, senderAccId);
|
||||||
} catch(SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1129,8 +1131,8 @@ public class MapleClient {
|
|||||||
saveVotePoints();
|
saveVotePoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void useVotePoints(int points){
|
public void useVotePoints(int points) {
|
||||||
if (points > votePoints){
|
if (points > votePoints) {
|
||||||
//Should not happen, should probably log this
|
//Should not happen, should probably log this
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1282,7 +1284,7 @@ public class MapleClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void announceDisableServerMessage() {
|
private void announceDisableServerMessage() {
|
||||||
if(!this.getWorldServer().registerDisabledServerMessage(player.getId())) {
|
if (!this.getWorldServer().registerDisabledServerMessage(player.getId())) {
|
||||||
announce(MaplePacketCreator.serverMessage(""));
|
announce(MaplePacketCreator.serverMessage(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1295,8 +1297,8 @@ public class MapleClient {
|
|||||||
long timeNow = System.currentTimeMillis();
|
long timeNow = System.currentTimeMillis();
|
||||||
int targetHash = player.getTargetHpBarHash();
|
int targetHash = player.getTargetHpBarHash();
|
||||||
|
|
||||||
if(mobHash != targetHash) {
|
if (mobHash != targetHash) {
|
||||||
if(timeNow - player.getTargetHpBarTime() >= 5 * 1000) {
|
if (timeNow - player.getTargetHpBarTime() >= 5 * 1000) {
|
||||||
// is there a way to INTERRUPT this annoying thread running on the client that drops the boss bar after some time at every attack?
|
// is there a way to INTERRUPT this annoying thread running on the client that drops the boss bar after some time at every attack?
|
||||||
announceDisableServerMessage();
|
announceDisableServerMessage();
|
||||||
announce(packet);
|
announce(packet);
|
||||||
@@ -1335,14 +1337,14 @@ public class MapleClient {
|
|||||||
if (!player.isAlive() || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) {
|
if (!player.isAlive() || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) {
|
||||||
announce(MaplePacketCreator.enableActions());
|
announce(MaplePacketCreator.enableActions());
|
||||||
return;
|
return;
|
||||||
} else if(MapleMiniDungeonInfo.isDungeonMap(player.getMapId())) {
|
} else if (MapleMiniDungeonInfo.isDungeonMap(player.getMapId())) {
|
||||||
announce(MaplePacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon."));
|
announce(MaplePacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon."));
|
||||||
announce(MaplePacketCreator.enableActions());
|
announce(MaplePacketCreator.enableActions());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] socket = Server.getInstance().getInetSocket(this.getSession(), getWorld(), channel);
|
String[] socket = Server.getInstance().getInetSocket(this.getSession(), getWorld(), channel);
|
||||||
if(socket == null) {
|
if (socket == null) {
|
||||||
announce(MaplePacketCreator.serverNotice(1, "Channel " + channel + " is currently disabled. Try another channel."));
|
announce(MaplePacketCreator.serverNotice(1, "Channel " + channel + " is currently disabled. Try another channel."));
|
||||||
announce(MaplePacketCreator.enableActions());
|
announce(MaplePacketCreator.enableActions());
|
||||||
return;
|
return;
|
||||||
@@ -1389,23 +1391,23 @@ public class MapleClient {
|
|||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRequestCharlist(){
|
public boolean canRequestCharlist() {
|
||||||
return lastNpcClick + 877 < Server.getInstance().getCurrentTime();
|
return lastNpcClick + 877 < Server.getInstance().getCurrentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canClickNPC(){
|
public boolean canClickNPC() {
|
||||||
return lastNpcClick + 500 < Server.getInstance().getCurrentTime();
|
return lastNpcClick + 500 < Server.getInstance().getCurrentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClickedNPC(){
|
public void setClickedNPC() {
|
||||||
lastNpcClick = Server.getInstance().getCurrentTime();
|
lastNpcClick = Server.getInstance().getCurrentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeClickedNPC(){
|
public void removeClickedNPC() {
|
||||||
lastNpcClick = 0;
|
lastNpcClick = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVisibleWorlds(){
|
public int getVisibleWorlds() {
|
||||||
return visibleWorlds;
|
return visibleWorlds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user