Trying to patch up some junky code in the management server

This commit is contained in:
ceikry
2021-08-10 00:02:47 -05:00
parent 7859c87565
commit 8efd877a11
8 changed files with 18 additions and 22 deletions
@@ -61,7 +61,7 @@ public class WorkerThread extends Thread {
*/ */
@SuppressWarnings("unused") //saving resource type for later @SuppressWarnings("unused") //saving resource type for later
public void run() { public void run() {
byte opcode = -1; /* byte opcode = -1;
try { try {
while (true) { while (true) {
opcode = is.readByte(); opcode = is.readByte();
@@ -104,8 +104,8 @@ public class WorkerThread extends Thread {
is.close(); is.close();
os.close(); os.close();
launcher.close(); launcher.close();
} catch (Exception e) {} } catch (Exception e) {e.printStackTrace();}
} }*/
} }
/** /**
@@ -168,9 +168,9 @@ public class IoSession {
} }
writingQueue.remove(0); writingQueue.remove(0);
} }
writingLock.unlock();
} catch (IOException e) { } catch (IOException e) {
disconnect(); disconnect();
} finally {
writingLock.unlock(); writingLock.unlock();
} }
} }
@@ -547,7 +547,7 @@ public class IoBuffer {
long second = getIntB(); long second = getIntB();
if (second < 0) if (second < 0)
second = second & 0xffffffffL; second = second & 0xffffffffL;
return (first << -41780448) + second; return (first << 32) + second;
} }
/** /**
@@ -567,7 +567,7 @@ public class IoBuffer {
if (peek <= Short.MAX_VALUE) { if (peek <= Short.MAX_VALUE) {
return buf.getShort() & 0xFFFF; return buf.getShort() & 0xFFFF;
} }
return (buf.getInt() & 0xFFFFFFFF) - 32768; return buf.getInt() - 32768;
} }
/** /**
@@ -49,7 +49,7 @@ public final class PunishmentStorage {
return; return;
} }
long end = Long.MAX_VALUE; long end = Long.MAX_VALUE;
if (duration != -1l && duration != 0L) { if (duration != -1L && duration != 0L) {
end = System.currentTimeMillis() + duration; end = System.currentTimeMillis() + duration;
} else if (duration == 0L) { } else if (duration == 0L) {
end = 0L; end = 0L;
@@ -12,10 +12,7 @@ import java.nio.ByteBuffer;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
/** /**
@@ -184,9 +181,7 @@ public final class CommunicationInfo {
String bl = set.getString("blocked"); String bl = set.getString("blocked");
if (bl != null && !bl.isEmpty()) { if (bl != null && !bl.isEmpty()) {
tokens = bl.split(","); tokens = bl.split(",");
for (String name : tokens) { blocked.addAll(Arrays.asList(tokens));
blocked.add(name);
}
} }
clanName = set.getString("clanName"); clanName = set.getString("clanName");
currentClan = set.getString("currentClan"); currentClan = set.getString("currentClan");
@@ -236,6 +231,9 @@ public final class CommunicationInfo {
case 2: case 2:
tradeSetting = Integer.parseInt(tokens[2]); tradeSetting = Integer.parseInt(tokens[2]);
break; break;
default:
System.out.println("Illegal arg count in chatsetting string: " + chatSettings);
break;
} }
} }
} }
@@ -409,8 +409,9 @@ public final class StringUtils {
} }
} }
} }
return -i_26_ + ((7 + i_30_) >> -662855293); return -i_26_ + ((7 + i_30_) >> 3);
} catch (RuntimeException runtimeexception) { } catch (RuntimeException runtimeexception) {
runtimeexception.printStackTrace();
} }
return 0; return 0;
} }
@@ -66,7 +66,7 @@ public final class PlayerSession {
/** /**
* The time stamp of last disconnection. * The time stamp of last disconnection.
*/ */
private long disconnectionTime = 0l; private long disconnectionTime = 0L;
/** /**
* How long the player is banned for. * How long the player is banned for.
@@ -463,11 +463,8 @@ public final class PlayerSession {
this.disconnectionTime = time; this.disconnectionTime = time;
} }
@Override public boolean equalsSession(PlayerSession o){
public boolean equals(Object o) { return username.equals(o.username);
if(o instanceof PlayerSession) {
return username.equals(((PlayerSession) o).username);
} else return false;
} }
@Override @Override
@@ -9,12 +9,12 @@ import java.util.*
object MSLogger { object MSLogger {
val t = Terminal() val t = Terminal()
val formatter = SimpleDateFormat("HH:mm:ss")
var tradeLog: Writer? = null var tradeLog: Writer? = null
var tradeLogWriter: BufferedWriter? = null var tradeLogWriter: BufferedWriter? = null
fun getTime(): String{ fun getTime(): String{
val formatter = SimpleDateFormat("HH:mm:ss")
return "[" + formatter.format(Date(System.currentTimeMillis())) +"]" return "[" + formatter.format(Date(System.currentTimeMillis())) +"]"
} }