Refactor unnecessary wrapper boolean

This commit is contained in:
P0nk
2024-09-13 21:47:52 +02:00
parent 7bd5fa387d
commit 719b079cbc
5 changed files with 7 additions and 9 deletions

View File

@@ -78,11 +78,9 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
@@ -256,7 +254,7 @@ public class Client extends ChannelInboundHandlerAdapter {
private void closeMapleSession() { private void closeMapleSession() {
switch (type) { switch (type) {
case LOGIN -> SessionCoordinator.getInstance().closeLoginSession(this); case LOGIN -> SessionCoordinator.getInstance().closeLoginSession(this);
case CHANNEL -> SessionCoordinator.getInstance().closeSession(this, null); case CHANNEL -> SessionCoordinator.getInstance().closeSession(this, false);
} }
try { try {

View File

@@ -294,7 +294,7 @@ public class SessionCoordinator {
return fakeClient; return fakeClient;
} }
public void closeSession(Client client, Boolean immediately) { public void closeSession(Client client, boolean immediately) {
if (client == null) { if (client == null) {
client = fetchInTransitionSessionClient(client); client = fetchInTransitionSessionClient(client);
} }
@@ -317,7 +317,7 @@ public class SessionCoordinator {
} }
} }
if (immediately != null && immediately) { if (immediately) {
client.closeSession(); client.closeSession();
} }
} }

View File

@@ -57,7 +57,7 @@ public final class AfterLoginHandler extends AbstractPacketHandler {
c.sendPacket(PacketCreator.requestPinAfterFailure()); c.sendPacket(PacketCreator.requestPinAfterFailure());
} }
} else if (c2 == 0 && c3 == 5) { } else if (c2 == 0 && c3 == 5) {
SessionCoordinator.getInstance().closeSession(c, null); SessionCoordinator.getInstance().closeSession(c, false);
c.updateLoginState(Client.LOGIN_NOTLOGGEDIN); c.updateLoginState(Client.LOGIN_NOTLOGGEDIN);
} }
} }

View File

@@ -35,7 +35,7 @@ public final class RegisterPinHandler extends AbstractPacketHandler {
public final void handlePacket(InPacket p, Client c) { public final void handlePacket(InPacket p, Client c) {
byte c2 = p.readByte(); byte c2 = p.readByte();
if (c2 == 0) { if (c2 == 0) {
SessionCoordinator.getInstance().closeSession(c, null); SessionCoordinator.getInstance().closeSession(c, false);
c.updateLoginState(Client.LOGIN_NOTLOGGEDIN); c.updateLoginState(Client.LOGIN_NOTLOGGEDIN);
} else { } else {
String pin = p.readString(); String pin = p.readString();
@@ -43,7 +43,7 @@ public final class RegisterPinHandler extends AbstractPacketHandler {
c.setPin(pin); c.setPin(pin);
c.sendPacket(PacketCreator.pinRegistered()); c.sendPacket(PacketCreator.pinRegistered());
SessionCoordinator.getInstance().closeSession(c, null); SessionCoordinator.getInstance().closeSession(c, false);
c.updateLoginState(Client.LOGIN_NOTLOGGEDIN); c.updateLoginState(Client.LOGIN_NOTLOGGEDIN);
} }
} }

View File

@@ -43,7 +43,7 @@ public class SetGenderHandler extends AbstractPacketHandler {
Server.getInstance().registerLoginState(c); Server.getInstance().registerLoginState(c);
} else { } else {
SessionCoordinator.getInstance().closeSession(c, null); SessionCoordinator.getInstance().closeSession(c, false);
c.updateLoginState(Client.LOGIN_NOTLOGGEDIN); c.updateLoginState(Client.LOGIN_NOTLOGGEDIN);
} }
} }