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-13 18:06:45 -05:00
|
|
|
if(msg == null)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if(origin == null)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
Petition report = new Petition(msg,origin);
|
|
|
|
|
if(report == null){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
report.updateDatabase();
|
|
|
|
|
}
|
|
|
|
|
catch(Exception e){
|
|
|
|
|
return false;
|
2023-08-13 13:45:07 -05:00
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|