Search in sources :

Example 1 with BigBrotherNotConnectedException

use of fr.glowstoner.fireapi.bigbrother.console.check.exceptions.BigBrotherNotConnectedException in project FireAPI by FireBlade-Serv.

the class BigBrotherConnectionCheck method connectionCheck.

public void connectionCheck() throws BigBrotherNotConnectedException {
    try {
        System.out.println("[FireAPI] Reconnection avec IP=" + this.client.getIP() + " et PORT=" + this.client.getPort());
        this.client = new Client(this.client.getIP(), this.client.getPort());
        this.client.start();
        ConnectionHandler ch = (ConnectionHandler) this.client;
        ch.sendPacket(new PacketLogin(this.infos.getKey(), this.infos.getPassword()));
        ch.sendPacket(new PacketVersion(this.infos.getVersionType()));
        ch.sendPacket(new PacketCommand("name " + this.infos.getId()));
        this.api.setClient((Client) ch);
        this.api.setChecker(this);
        this.callListener(ch);
    } catch (Exception ex) {
        throw new BigBrotherNotConnectedException("Erreur sur l'envoi d'un packet (connection protocol) " + "ErreurClass = " + ex.getClass().getSimpleName() + ", " + ex.getMessage());
    }
}
Also used : ConnectionHandler(fr.glowstoner.connectionsapi.network.ConnectionHandler) PacketCommand(fr.glowstoner.connectionsapi.network.packets.command.PacketCommand) PacketVersion(fr.glowstoner.fireapi.bigbrother.console.packets.PacketVersion) BigBrotherNotConnectedException(fr.glowstoner.fireapi.bigbrother.console.check.exceptions.BigBrotherNotConnectedException) PacketLogin(fr.glowstoner.connectionsapi.network.packets.login.PacketLogin) Client(fr.glowstoner.connectionsapi.network.client.Client) BigBrotherNotConnectedException(fr.glowstoner.fireapi.bigbrother.console.check.exceptions.BigBrotherNotConnectedException)

Aggregations

ConnectionHandler (fr.glowstoner.connectionsapi.network.ConnectionHandler)1 Client (fr.glowstoner.connectionsapi.network.client.Client)1 PacketCommand (fr.glowstoner.connectionsapi.network.packets.command.PacketCommand)1 PacketLogin (fr.glowstoner.connectionsapi.network.packets.login.PacketLogin)1 BigBrotherNotConnectedException (fr.glowstoner.fireapi.bigbrother.console.check.exceptions.BigBrotherNotConnectedException)1 PacketVersion (fr.glowstoner.fireapi.bigbrother.console.packets.PacketVersion)1