Save accepted ToS to PG

This commit is contained in:
P0nk
2024-09-26 21:13:40 +02:00
parent c7f835da0d
commit 0f2ef341ce
8 changed files with 136 additions and 49 deletions

View File

@@ -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");
}