BuuSocket API 0.1

Simple and Secure Bungee - Spigot communication

  1. Buubuulle
    Native Minecraft Version:
    Legacy (< 1.13)
    Tested Minecraft Versions:
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    • 1.15
    Source Code:
    https://gitlab.com/Buubuulle/buusocket
    BuuSocket
    BuuSocket is an API for Spigot and BungeeCord that allows to communicate without going through PluginMessages, so the data no longer need a player and this makes this system secure.

    Tutorial

    The first thing to do is to import the API into your project and into the plugins of your server.

    Then you must create the BuuClient (On the Spigot side)
    Code (Text):
    BuuClient client = new BuuClient(port); //Default port: 2605
    And the BuuServer (On the BungeeCord side)
    Code (Text):
    BuuServer server = new BuuServer(port); //Default port: 2605

    Send

    Client side (Spigot):
    Code (Text):
    public void sendData() {
        BuuClient client = new BuuClient(port); //Default port: 2605
        DataOutputStream out = client.getOutput();

        out.writeUTF("Like PluginMessages");
        out.write...
        out.write...

        client.send(out);
    }
    Server side (Bungee)
    Code (Text):
    public void sendData() {
        BuuServer server = new BuuServer(port); //Default port: 2605

        DataOutputStream out = server.getOutput("ClientName - Sent from the client side");
        //OR
        Collection<DataOutputStream> outs = server.getOutputs(); //All clients (Spigot servers)

        out.writeUTF("Like PluginMessages");
        out.write...
        out.write...

        server.send(out);
    }

    Receive

    To receive data BuuSocket add two events

    On Spigot (BuuClient)
    Code (Text):
    @EventHandler
    public void onBuuClientReceivingData(BuuClientReceivingDataEvent event) {
        DataInputStream in = event.getData();

        in.readUTF("Like PluginMessages");
        in.read...
        in.read...
    }
    On BungeeCord (BuuServer)
    Code (Text):
    @EventHandler
    public void onBuuServerReceivingData(BuuServerReceivingDataEvent event) {
        DataInputStream in = event.getData();

        in.readUTF("Like PluginMessages");
        in.read...
        in.read...
    }