You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.8 KiB
54 lines
1.8 KiB
3 years ago
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||
|
// Magicbane Emulator Project © 2013 - 2022
|
||
|
// www.magicbane.com
|
||
|
|
||
|
package engine.net;
|
||
|
|
||
|
import engine.gameManager.ConfigManager;
|
||
|
import engine.job.AbstractJob;
|
||
|
import engine.net.client.msg.ClientNetMsg;
|
||
|
import org.pmw.tinylog.Logger;
|
||
|
|
||
|
public class CheckNetMsgFactoryJob extends AbstractJob {
|
||
|
|
||
|
private final AbstractConnection conn;
|
||
|
|
||
|
public CheckNetMsgFactoryJob(AbstractConnection conn) {
|
||
|
super();
|
||
|
this.conn = conn;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected void doJob() {
|
||
|
NetMsgFactory factory = conn.getFactory();
|
||
|
|
||
|
// Make any/all msg possible
|
||
|
factory.parseBuffer();
|
||
|
|
||
|
// get and route.
|
||
|
AbstractNetMsg msg = factory.getMsg();
|
||
|
while (msg != null) {
|
||
|
|
||
|
// Conditionally check to see if origin is set.
|
||
|
if (msg.getOrigin() == null) {
|
||
|
Logger.warn(msg.getClass().getSimpleName() + " had a NULL for its 'origin'.");
|
||
|
msg.setOrigin(this.conn);
|
||
|
}
|
||
|
|
||
|
if (msg instanceof engine.net.client.msg.ClientNetMsg) {
|
||
|
ConfigManager.handler.handleClientMsg((ClientNetMsg) msg);
|
||
|
|
||
|
} else {
|
||
|
Logger.error("Unrouteable message of type '" + msg.getClass().getSimpleName() + '\'');
|
||
|
}
|
||
|
|
||
|
msg = factory.getMsg();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|