API Documentation

I'll keep this simple and to the point. How to make your plugin compatible:

Step 1: What is this

If you have a plugin that modifies player speed or other things that could cause AntiCheat to think a player is hacking, you can easily keep your plugin functional by hooking into AntiCheat's API. First, determine the places in your code where you will be changing player's behavior. You then have two choices:

  • Exempt a player from the check momentarily - If you only modify player behavior for a while and then switch back to a vanilla system, the best thing to do is to use the exempt methods. This allows a player to not enter a certain check until you say they should.
  • Turn off an entire check - If your plugin modifies everyone on the server's behavior for short or extended periods of time, it would be better to turn off the check so that nobody gets affected by it.

Step 2: How do I use it

Code time. You'll need to import AntiCheat as a library to your project. You did this with craftbukkit/bukkit to make your plugin, now do it with AntiCheat.jar. If you don't know how/don't remember how to do this, google search "libraries" or "dependencies" with the name of your IDE.

The AntiCheat repository is located at http://repo.gravitydevelopment.net/ - if you're using Maven, follow the instructions on that page to add the repository to your maven pom.xml, then add AntiCheat as a dependency:

    <dependencies>
        <dependency>
            <groupId>net.gravitydevelopment.anticheat</groupId>
            <artifactId>AntiCheat</artifactId>
            <version>2.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>

You'll want to make sure that AntiCheat is running on the server, or else you'll get errors when trying to use the API, seeing as it doesn't exist..

if(Bukkit.getServer().getPluginManager().getPlugin("AntiCheat") != null)
{
  //Access AntiCheat here.
}

Now, hit up that place in your code where you start modifying player behavior. We'll access the CheckManager like so:

AntiCheatAPI.activateCheck(CheckType.FLY);

It's that easy :P. Here's how to exempt a player from a check temporarily:

AntiCheatAPI.exemptPlayer(player, CheckType.FLY);

And then we can un-exempt him later as we return to normal behavior:

AntiCheatAPI.unexemptPlayer(player, CheckType.FLY);

Here's how to turn on/off a check:

AntiCheatAPI.deactivateCheck(CheckType.FLY);
AntiCheatAPI.activateCheck(CheckType.FLY);

Step 3: This is really important :S

Last but certainly not least, you want to make sure AntiCheat loads before your plugin does, that way you are able to use the API. Head to your plugin.yml and add:

softdepend: [AntiCheat]

If you happen to already been softdepending another plugin, just add it like so:

softdepend: [Vault,AntiCheat]

And that's all there is. If you want to read the documentation for the API, head over here: http://gravitydevelopment.net/docs/anticheat/ (or more specifically HERE for information about the AntiCheatAPI, which is the only class you should really ever need to bother with.)