Save accepted ToS to PG
This commit is contained in:
@@ -276,7 +276,7 @@ public final class PacketProcessor {
|
||||
}
|
||||
|
||||
private void registerLoginHandlers() {
|
||||
registerHandler(RecvOpcode.ACCEPT_TOS, new AcceptToSHandler());
|
||||
registerHandler(RecvOpcode.ACCEPT_TOS, new AcceptToSHandler(channelDeps.accountService()));
|
||||
registerHandler(RecvOpcode.AFTER_LOGIN, new AfterLoginHandler());
|
||||
registerHandler(RecvOpcode.SERVERLIST_REREQUEST, new ServerlistRequestHandler());
|
||||
registerHandler(RecvOpcode.CHARLIST_REQUEST, new CharlistRequestHandler());
|
||||
|
||||
@@ -4,12 +4,19 @@ import client.Client;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.netty.GameViolationException;
|
||||
import net.packet.InPacket;
|
||||
import service.AccountService;
|
||||
import tools.PacketCreator;
|
||||
|
||||
/**
|
||||
* @author kevintjuh93
|
||||
* @author Ponk
|
||||
*/
|
||||
public final class AcceptToSHandler extends AbstractPacketHandler {
|
||||
private final AccountService accountService;
|
||||
|
||||
public AcceptToSHandler(final AccountService accountService) {
|
||||
this.accountService = accountService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validateState(Client c) {
|
||||
@@ -18,7 +25,7 @@ public final class AcceptToSHandler extends AbstractPacketHandler {
|
||||
|
||||
@Override
|
||||
public void handlePacket(InPacket p, Client c) {
|
||||
if (p.available() == 0 || p.readByte() != 1 || c.acceptToS()) {
|
||||
if (p.available() == 0 || p.readByte() != 1 || !accountService.acceptTos(c.getAccID())) {
|
||||
throw new GameViolationException("ToS not accepted");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user