Remove unused stuff in Client
This commit is contained in:
@@ -285,10 +285,6 @@ public class Client extends ChannelInboundHandlerAdapter {
|
|||||||
return remoteAddress;
|
return remoteAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTransition() {
|
|
||||||
return inTransition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EventManager getEventManager(String event) {
|
public EventManager getEventManager(String event) {
|
||||||
return getChannelServer().getEventSM().getEventManager(event);
|
return getChannelServer().getEventSM().getEventManager(event);
|
||||||
}
|
}
|
||||||
@@ -321,14 +317,6 @@ public class Client extends ChannelInboundHandlerAdapter {
|
|||||||
return chars;
|
return chars;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> loadCharacterNames(int worldId) {
|
|
||||||
List<String> chars = new ArrayList<>(15);
|
|
||||||
for (CharNameAndId cni : loadCharactersInternal(worldId)) {
|
|
||||||
chars.add(cni.name);
|
|
||||||
}
|
|
||||||
return chars;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<CharNameAndId> loadCharactersInternal(int worldId) {
|
private List<CharNameAndId> loadCharactersInternal(int worldId) {
|
||||||
List<CharNameAndId> chars = new ArrayList<>(15);
|
List<CharNameAndId> chars = new ArrayList<>(15);
|
||||||
try (Connection con = DatabaseConnection.getConnection();
|
try (Connection con = DatabaseConnection.getConnection();
|
||||||
@@ -426,21 +414,6 @@ public class Client extends ChannelInboundHandlerAdapter {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadHWIDIfNescessary() throws SQLException {
|
|
||||||
if (hwid == null) {
|
|
||||||
try (Connection con = DatabaseConnection.getConnection();
|
|
||||||
PreparedStatement ps = con.prepareStatement("SELECT hwid FROM accounts WHERE id = ?")) {
|
|
||||||
ps.setInt(1, accId);
|
|
||||||
|
|
||||||
try (ResultSet rs = ps.executeQuery()) {
|
|
||||||
if (rs.next()) {
|
|
||||||
hwid = new Hwid(rs.getString("hwid"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Recode to close statements...
|
// TODO: Recode to close statements...
|
||||||
private void loadMacsIfNescessary() throws SQLException {
|
private void loadMacsIfNescessary() throws SQLException {
|
||||||
if (macs.isEmpty()) {
|
if (macs.isEmpty()) {
|
||||||
@@ -460,20 +433,6 @@ public class Client extends ChannelInboundHandlerAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void banHWID() {
|
|
||||||
try {
|
|
||||||
loadHWIDIfNescessary();
|
|
||||||
|
|
||||||
try (Connection con = DatabaseConnection.getConnection();
|
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO hwidbans (hwid) VALUES (?)")) {
|
|
||||||
ps.setString(1, hwid.hwid());
|
|
||||||
ps.executeUpdate();
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void banMacs() {
|
public void banMacs() {
|
||||||
try {
|
try {
|
||||||
loadMacsIfNescessary();
|
loadMacsIfNescessary();
|
||||||
@@ -708,23 +667,6 @@ public class Client extends ChannelInboundHandlerAdapter {
|
|||||||
return tempBanCalendar;
|
return tempBanCalendar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBeenBanned() {
|
|
||||||
return tempBanCalendar != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long dottedQuadToLong(String dottedQuad) throws RuntimeException {
|
|
||||||
String[] quads = dottedQuad.split("\\.");
|
|
||||||
if (quads.length != 4) {
|
|
||||||
throw new RuntimeException("Invalid IP Address format.");
|
|
||||||
}
|
|
||||||
long ipAddress = 0;
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
int quad = Integer.parseInt(quads[i]);
|
|
||||||
ipAddress += (long) (quad % 256) * (long) Math.pow(256, 4 - i);
|
|
||||||
}
|
|
||||||
return ipAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateHwid(Hwid hwid) {
|
public void updateHwid(Hwid hwid) {
|
||||||
this.hwid = hwid;
|
this.hwid = hwid;
|
||||||
|
|
||||||
@@ -1218,20 +1160,6 @@ public class Client extends ChannelInboundHandlerAdapter {
|
|||||||
actionsSemaphore.release();
|
actionsSemaphore.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tryacquireEncoder() {
|
|
||||||
if (actionsSemaphore.tryAcquire()) {
|
|
||||||
encoderLock.lock();
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unlockEncoder() {
|
|
||||||
encoderLock.unlock();
|
|
||||||
actionsSemaphore.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class CharNameAndId {
|
private static class CharNameAndId {
|
||||||
|
|
||||||
public String name;
|
public String name;
|
||||||
|
|||||||
Reference in New Issue
Block a user