Added cash shop name changes and world transfers. (#495)

* Name changes

* World transfers. Fix NPE. Applied Arnuh's suggestions. More logging.
This commit is contained in:
Ubaware
2019-07-31 16:22:48 -07:00
committed by Ronan Lana
parent 85812ba489
commit 153f5de4fa
14 changed files with 733 additions and 20 deletions

View File

@@ -121,6 +121,7 @@ public class MapleClient {
private final Lock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CLIENT, true);
private final Lock encoderLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CLIENT_ENCODER, true);
private static final Lock loginLocks[] = new Lock[200]; // thanks Masterrulax & try2hack for pointing out a bottleneck issue here
private Calendar tempBanCalendar;
private int votePoints;
private int voteTime = -1;
private int visibleWorlds;
@@ -640,7 +641,7 @@ public class MapleClient {
}
}
public Calendar getTempBanCalendar() {
public Calendar getTempBanCalendarFromDB() {
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
@@ -654,10 +655,12 @@ public class MapleClient {
return null;
}
long blubb = rs.getLong("tempban");
if (blubb == 0) { // basically if timestamp in db is 0000-00-00
if (blubb == 0 || rs.getString("tempban").equals("2018-06-20 00:00:00.0")) { // 0000-00-00 or 2018-06-20 (default set in LoginPasswordHandler)
return null;
}
lTempban.setTimeInMillis(rs.getTimestamp("tempban").getTime());
tempBanCalendar = lTempban;
return lTempban;
} catch (SQLException e) {
e.printStackTrace();
@@ -678,6 +681,14 @@ public class MapleClient {
}
return null;//why oh why!?!
}
public Calendar getTempBanCalendar() {
return tempBanCalendar;
}
public boolean hasBeenBanned() {
return tempBanCalendar != null;
}
public static long dottedQuadToLong(String dottedQuad) throws RuntimeException {
String[] quads = dottedQuad.split("\\.");
@@ -1017,6 +1028,7 @@ public class MapleClient {
player.saveCharToDB(true);
player.logOff();
if(ServerConstants.INSTANT_NAME_CHANGE) player.doPendingNameChange();
clear();
} else {
getChannelServer().removePlayer(player);
@@ -1329,6 +1341,10 @@ public class MapleClient {
return (short) Math.max(0, characterSlots - Server.getInstance().getAccountWorldCharacterCount(accId, world));
}
public short getAvailableCharacterWorldSlots(int world) {
return (short) Math.max(0, characterSlots - Server.getInstance().getAccountWorldCharacterCount(accId, world));
}
public short getCharacterSlots() {
return characterSlots;
}