forked from MagicBane/Server
				
			
				 7 changed files with 3 additions and 158 deletions
			
			
		@ -1,102 +0,0 @@
				@@ -1,102 +0,0 @@
					 | 
				
			||||
// • ▌ ▄ ·.  ▄▄▄·  ▄▄ • ▪   ▄▄· ▄▄▄▄·  ▄▄▄·  ▐▄▄▄  ▄▄▄ .
 | 
				
			||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
 | 
				
			||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
 | 
				
			||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
 | 
				
			||||
// ▀▀  █▪▀▀▀ ▀  ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀  ▀  ▀ ▀▀  █▪ ▀▀▀
 | 
				
			||||
//      Magicbane Emulator Project © 2013 - 2022
 | 
				
			||||
//                www.magicbane.com
 | 
				
			||||
 | 
				
			||||
 | 
				
			||||
package engine.net.client; | 
				
			||||
 | 
				
			||||
import engine.gameManager.SessionManager; | 
				
			||||
import engine.net.NetMsgHandler; | 
				
			||||
import engine.net.client.handlers.AbstractClientMsgHandler; | 
				
			||||
import engine.net.client.msg.ClientNetMsg; | 
				
			||||
import engine.server.world.WorldServer; | 
				
			||||
import engine.session.Session; | 
				
			||||
import engine.util.StringUtils; | 
				
			||||
import org.pmw.tinylog.Logger; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author: | 
				
			||||
 * @summary: This class is the mainline router for application protocol | 
				
			||||
 * messages received by the client. | 
				
			||||
 */ | 
				
			||||
 | 
				
			||||
public class ClientMessagePump implements NetMsgHandler { | 
				
			||||
 | 
				
			||||
    // Instance variable declaration
 | 
				
			||||
 | 
				
			||||
    private final WorldServer server; | 
				
			||||
 | 
				
			||||
    public ClientMessagePump(WorldServer server) { | 
				
			||||
        super(); | 
				
			||||
        this.server = server; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    //Handle RepairObject Window and RepairObject Requests
 | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public boolean handleClientMsg(ClientNetMsg msg) { | 
				
			||||
 | 
				
			||||
        if (msg == null) { | 
				
			||||
            Logger.error("handleClientMsg", "Recieved null msg. Returning."); | 
				
			||||
            return false; | 
				
			||||
        } | 
				
			||||
 | 
				
			||||
        ClientConnection origin; | 
				
			||||
        Protocol protocolMsg = Protocol.NONE; | 
				
			||||
        Session s; | 
				
			||||
 | 
				
			||||
        try { | 
				
			||||
 | 
				
			||||
            // Try registered opcodes first as we take a hatchet to this GodObject
 | 
				
			||||
 | 
				
			||||
            AbstractClientMsgHandler msgHandler = msg.getProtocolMsg().handler; | 
				
			||||
 | 
				
			||||
            if (msgHandler != null) | 
				
			||||
                return msgHandler.handleNetMsg(msg); | 
				
			||||
 | 
				
			||||
            // Any remaining opcodes fall through and are routed
 | 
				
			||||
            // through this ungodly switch of doom.
 | 
				
			||||
 | 
				
			||||
            origin = (ClientConnection) msg.getOrigin(); | 
				
			||||
            s = SessionManager.getSession(origin); | 
				
			||||
 | 
				
			||||
            protocolMsg = msg.getProtocolMsg(); | 
				
			||||
 | 
				
			||||
            switch (protocolMsg) { | 
				
			||||
 | 
				
			||||
                case READYTOENTER: | 
				
			||||
                    break; | 
				
			||||
                case OPENVAULT: | 
				
			||||
                    break; | 
				
			||||
                case CHANNELMUTE: | 
				
			||||
                    break; | 
				
			||||
                case KEEPALIVESERVERCLIENT: | 
				
			||||
                    break; | 
				
			||||
                case UNKNOWN: | 
				
			||||
                    break; | 
				
			||||
 | 
				
			||||
                case CONFIRMPROMOTE: | 
				
			||||
                    break; | 
				
			||||
 | 
				
			||||
                default: | 
				
			||||
                    String ocHex = StringUtils.toHexString(protocolMsg.opcode); | 
				
			||||
                    Logger.error("Cannot handle Opcode: " + ocHex + " " + protocolMsg.name()); | 
				
			||||
                    return false; | 
				
			||||
 | 
				
			||||
            } | 
				
			||||
 | 
				
			||||
        } catch (Exception e) { | 
				
			||||
            Logger.error("handler for " + protocolMsg + " failed:  " + e); | 
				
			||||
            return false; | 
				
			||||
        } | 
				
			||||
 | 
				
			||||
        return true; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
 | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -1,47 +0,0 @@
				@@ -1,47 +0,0 @@
					 | 
				
			||||
// • ▌ ▄ ·.  ▄▄▄·  ▄▄ • ▪   ▄▄· ▄▄▄▄·  ▄▄▄·  ▐▄▄▄  ▄▄▄ .
 | 
				
			||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
 | 
				
			||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
 | 
				
			||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
 | 
				
			||||
// ▀▀  █▪▀▀▀ ▀  ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀  ▀  ▀ ▀▀  █▪ ▀▀▀
 | 
				
			||||
//      Magicbane Emulator Project © 2013 - 2022
 | 
				
			||||
//                www.magicbane.com
 | 
				
			||||
 | 
				
			||||
 | 
				
			||||
package engine.server.login; | 
				
			||||
 | 
				
			||||
import engine.net.NetMsgHandler; | 
				
			||||
import engine.net.client.ClientConnection; | 
				
			||||
import engine.net.client.Protocol; | 
				
			||||
import engine.net.client.msg.ClientNetMsg; | 
				
			||||
import org.pmw.tinylog.Logger; | 
				
			||||
 | 
				
			||||
public class LoginServerMsgHandler implements NetMsgHandler { | 
				
			||||
 | 
				
			||||
    private final LoginServer server; | 
				
			||||
 | 
				
			||||
    LoginServerMsgHandler(LoginServer server) { | 
				
			||||
        super(); | 
				
			||||
        this.server = server; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /* | 
				
			||||
     * ========================================================================= | 
				
			||||
     * Client Messages | 
				
			||||
     * ========================================================================= | 
				
			||||
     */ | 
				
			||||
    @Override | 
				
			||||
    public boolean handleClientMsg(ClientNetMsg clientNetMsg) { | 
				
			||||
 | 
				
			||||
        if (clientNetMsg == null) { | 
				
			||||
            Logger.error("Recieved null msg. Returning."); | 
				
			||||
            return false; | 
				
			||||
        } | 
				
			||||
 | 
				
			||||
        ClientConnection origin = (ClientConnection) clientNetMsg.getOrigin(); | 
				
			||||
        Protocol protocolMsg = clientNetMsg.getProtocolMsg(); | 
				
			||||
 | 
				
			||||
        return true; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
 | 
				
			||||
} | 
				
			||||
					Loading…
					
					
				
		Reference in new issue