Venusanticheat docs

VenusApi interface

The root of the API. Everything else hangs off one of the services returned here.

Inherits from nothing — this is the entry point. Obtain an instance from VenusAPIProvider.

package xyz.kaosmc.anticheat.api
SignatureDescription
Server server()Identity, TPS, player count, the profiler and reloadConfig().
UserRepository users()Lookup of users Venus is currently tracking.
CheckRegistry checks()The check catalog, available with nobody online.
Events events()Listener registration and event dispatch.
Subcommands subcommands()Custom /venus subcommands.
PunishmentService punishments()Kick, ban and ban-wave control.
HistoryService history()Sessions and violations from storage.
AlertService alerts()Per-user alert, verbose, brand and mitigation channels.
ExemptionService exemptions()Exemptions and tolerance presets.
CloudService cloud()Cloud connection state and mitigation profiles.
String version()The Venus build version, e.g. 1.1.2.
boolean started()True once the plugin has fully started.
int currentTick()The server tick Venus is on right now.
CompletableFuture<Boolean> reload()Reloads the configuration; completes with whether it succeeded.
void registerVariable(String, Function<User, String>)Registers a per-user message variable such as %clan%. Passing null removes it.
void registerVariable(String, String)Registers a static message variable such as %server%.

Using it

a plugin that reacts to detections
public final class VenusHook {

    private static VenusApi api;

    static void init() {
        api = VenusAPIProvider.get();

        api.events().repository().register(DetectionAlertEvent.class, event -> {
            double vl = event.violationLevel();
            if (vl > 50) {
                api.punishments().ban(event.user(), "Killaura (" + Math.round(vl) + ")");
            }
        }, EventPriority.NORMAL, /* ignoreCancelled= */ true);

        api.registerVariable("clan", user -> clans.of(user.uuid().toString()));
    }

    public static void shutdown() {
        if (api != null) api.events().repository().unregisterAll();
    }
}

Reload semantics

reload() re-reads every configuration file and returns a future that completes once listeners have been notified. It does not reconnect the datastore or the cloud; those survive a reload and pick up new settings on their next reconnect.

Registering message variables

Variables registered here are substituted in the same place the built-in placeholders are, so they work in alert templates, command output and anything else parsed through messages.yml. See localisation for the built-in set.