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 5c8774de89
commit d23b53ba6f
8 changed files with 18 additions and 22 deletions

View file

@ -61,7 +61,7 @@ public class WorkerThread extends Thread {
*/
@SuppressWarnings("unused") //saving resource type for later
public void run() {
byte opcode = -1;
/* byte opcode = -1;
try {
while (true) {
opcode = is.readByte();
@ -104,8 +104,8 @@ public class WorkerThread extends Thread {
is.close();
os.close();
launcher.close();
} catch (Exception e) {}
}
} catch (Exception e) {e.printStackTrace();}
}*/
}
/**

View file

@ -168,9 +168,9 @@ public class IoSession {
}
writingQueue.remove(0);
}
writingLock.unlock();
} catch (IOException e) {
disconnect();
} finally {
writingLock.unlock();
}
}

View file

@ -547,7 +547,7 @@ public class IoBuffer {
long second = getIntB();
if (second < 0)
second = second & 0xffffffffL;
return (first << -41780448) + second;
return (first << 32) + second;
}
/**
@ -567,7 +567,7 @@ public class IoBuffer {
if (peek <= Short.MAX_VALUE) {
return buf.getShort() & 0xFFFF;
}
return (buf.getInt() & 0xFFFFFFFF) - 32768;
return buf.getInt() - 32768;
}
/**

View file

@ -49,7 +49,7 @@ public final class PunishmentStorage {
return;
}
long end = Long.MAX_VALUE;
if (duration != -1l && duration != 0L) {
if (duration != -1L && duration != 0L) {
end = System.currentTimeMillis() + duration;
} else if (duration == 0L) {
end = 0L;

View file

@ -12,10 +12,7 @@ import java.nio.ByteBuffer;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.Map.Entry;
/**
@ -184,9 +181,7 @@ public final class CommunicationInfo {
String bl = set.getString("blocked");
if (bl != null && !bl.isEmpty()) {
tokens = bl.split(",");
for (String name : tokens) {
blocked.add(name);
}
blocked.addAll(Arrays.asList(tokens));
}
clanName = set.getString("clanName");
currentClan = set.getString("currentClan");
@ -236,6 +231,9 @@ public final class CommunicationInfo {
case 2:
tradeSetting = Integer.parseInt(tokens[2]);
break;
default:
System.out.println("Illegal arg count in chatsetting string: " + chatSettings);
break;
}
}
}

View file

@ -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) {
runtimeexception.printStackTrace();
}
return 0;
}

View file

@ -66,7 +66,7 @@ public final class PlayerSession {
/**
* The time stamp of last disconnection.
*/
private long disconnectionTime = 0l;
private long disconnectionTime = 0L;
/**
* How long the player is banned for.
@ -463,11 +463,8 @@ public final class PlayerSession {
this.disconnectionTime = time;
}
@Override
public boolean equals(Object o) {
if(o instanceof PlayerSession) {
return username.equals(((PlayerSession) o).username);
} else return false;
public boolean equalsSession(PlayerSession o){
return username.equals(o.username);
}
@Override

View file

@ -9,12 +9,12 @@ import java.util.*
object MSLogger {
val t = Terminal()
val formatter = SimpleDateFormat("HH:mm:ss")
var tradeLog: Writer? = null
var tradeLogWriter: BufferedWriter? = null
fun getTime(): String{
val formatter = SimpleDateFormat("HH:mm:ss")
return "[" + formatter.format(Date(System.currentTimeMillis())) +"]"
}