Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.
/ BACPluginAPI Public archive

APIs available for servers using the BAC plugin. You can learn more about getting BAC for your server at https://bac.badlion.net/

License

Notifications You must be signed in to change notification settings

BadlionClient/BACPluginAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Badlion AntiCheat API

This repository explains how to use Badlion AntiCheat Api bundled in the BAC plugin.

You can purchase it at https://store.badlion.net/category/bac/

Maven dependency

  1. Clone this repository
  2. Run mvn clean install
  3. Add the following code to your pom.xml file :
<dependency>
    <groupId>net.badlion.heartbeat</groupId>
    <artifactId>heartbeat-api</artifactId>
    <version>1.0-SNAPSHOT</version>
    <scope>provided</scope>
</dependency>

/!\ Make sure to set it as provided or it won't be working properly.

API Usage

All the methods that you can use are documented here.

Plugin Message API

In case you are running the plugin on your BungeeCord proxy, and you want to know if an user is using Badlion Anticheat from your Bukkit server, you can use our plugin message API

public class BadlionAnticheatExample extends JavaPlugin implements Listener, PluginMessageListener {

    @Override
    public void onEnable() {
        this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
        this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
        this.getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onLogin(final PlayerJoinEvent event) {
        this.getServer().getScheduler().runTaskLater(this, new Runnable() {
            @Override
            public void run() {

                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);

                try {
                    dataOutputStream.writeUTF("heartbeat");
                } catch (IOException ignored) {
                    return;
                }

                event.getPlayer().sendPluginMessage(BadlionAnticheatExample.this, "BungeeCord", byteArrayOutputStream.toByteArray());
            }
        }, 20L);
    }

    @Override
    public void onPluginMessageReceived(String channel, Player player, byte[] bytes) {
        if (channel.equals("BungeeCord")) {
            DataInputStream dataInputStream = new DataInputStream(new ByteArrayInputStream(bytes));

            try {
                if (dataInputStream.readUTF().equals("heartbeat")) {
                    switch (dataInputStream.readUTF()) {
                        case "true":
                            // Your code here
                            // User is using Badlion AntiCheat
                            break;

                        case "false":
                            // Your code here
                            // User is not using Badlion AntiCheat
                            break;
                    }
                }
            } catch (IOException ignored) {

            }
        }
    }
}

About

APIs available for servers using the BAC plugin. You can learn more about getting BAC for your server at https://bac.badlion.net/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages