GrimAC Help

Developer API

You can use the API to integrate Grim into your plugin. The source code can be found on the github.

Getting started

repositories { maven("https://jitpack.io/") }

 

dependencies { compileOnly("com.github.grimanticheat:grimapi:VERSION") // replace this with actual version }
<repository> <id>jitpack.io</id> <url>https://jitpack.io/</url> </repository>

 

<dependency> <groupId>com.github.grimanticheat</groupId> <artifactId>grimapi</artifactId> <version>VERSION</version><!-- replace this with the actual version --> </dependency>

Ensure that your plugin depends on GrimAC in your plugin.yml.

softdepend: - ProtocolLib

You can retrieve an instance of the API implementation using Bukkit's service provider whenever your plugin starts.

if (Bukkit.getPluginManager().isPluginEnabled("GrimAC")) { RegisteredServiceProvider<GrimAbstractAPI> provider = Bukkit.getServicesManager().getRegistration(GrimAbstractAPI.class); if (provider != null) { GrimAbstractAPI api = provider.getProvider(); } }

Bukkit Events

A list of grim bukkit events can be found on the github. Here's an example of how you can print to console when a player flags a checks.

@EventHandler public void onGrimFlag(FlagEvent event) { GrimUser user = event.getPlayer(); AbstractCheck check = event.getCheck(); Bukkit.getConsoleSender().sendMessage(user.getName() + " flagged check " + check.getCheckName()); }

Registering variables

You can use the API to register variables you can use within the configuration files of Grim.

// get a instance of the API GrimAbstractAPI api = getInstance(); // registers a variable based on the user api.registerVariable("%keep_alive_ping%", user -> user.getKeepAlivePing() + ""); // registers a static variable api.registerVariable("%server%", user -> "Server Name");
Last modified: 23 February 2024