Files
prestonbane/src/engine/net/client/handlers/PetitionReceivedMsgHandler.java
T

36 lines
898 B
Java
Raw Normal View History

2023-08-13 13:45:07 -05:00
package engine.net.client.handlers;
import engine.exception.MsgSendException;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.PetitionReceivedMsg;
2023-08-13 18:06:45 -05:00
import engine.objects.Petition;
2023-08-13 13:45:07 -05:00
public class PetitionReceivedMsgHandler extends AbstractClientMsgHandler {
2023-08-13 15:45:11 -05:00
public PetitionReceivedMsgHandler() {
super(PetitionReceivedMsg.class);
2023-08-13 13:45:07 -05:00
}
@Override
protected boolean _handleNetMsg(ClientNetMsg msg, ClientConnection origin) throws MsgSendException {
2023-08-14 12:48:05 -04:00
if (msg == null)
2023-08-13 18:06:45 -05:00
return false;
2023-08-14 12:48:05 -04:00
if (origin == null)
2023-08-13 18:06:45 -05:00
return false;
2023-08-14 12:48:05 -04:00
Petition report = new Petition(msg, origin);
if (report == null)
2023-08-13 18:06:45 -05:00
return false;
2023-08-13 18:06:45 -05:00
try {
report.updateDatabase();
2023-08-14 12:48:05 -04:00
} catch (Exception e) {
2023-08-13 18:06:45 -05:00
return false;
}
return true;
}
2023-08-13 13:45:07 -05:00
}