Check interface
One check, viewed either as a catalog definition or as live state for a tracked player.
Identity and metadata
| Signature | Description |
|---|---|
String name() | Display name, e.g. BadPacketsX. What alerts show unless a custom name replaces it. |
String alternativeName() | Legacy alias kept for compatibility with older configuration. |
String stableKey() | Canonical cross-version identity, e.g. badpackets.duplicate_slot. Use this in anything you store. See CheckRegistry. |
CheckType type() | Coarse classification; see the type enums. |
String category() | The category segment used in the permission node. |
String description() | What the check looks for, as declared by its author. |
boolean experimental() | True for checks that are still being tuned. |
State
| Signature | Description |
|---|---|
boolean enabled() | Whether this check is on for the user (or globally, for a definition). |
void setEnabled(boolean) | On a definition this switches the check globally; on a live check it applies to that user. |
double violationLevel() | Accumulated evidence for the wrapped user. Always 0 for a definition. |
void resetViolations() | Clears the violation level for the wrapped user. |
double decay() | How much the violation level falls over time. |
double setbackVl() | The level at which positions start being corrected. |
double punishVl() | The configured punishment threshold. See PunishmentService for what happens when it is reached. |
PunishmentType punishmentType() | What reaching the threshold does; null when the check only alerts. |
Escape hatch
| Signature | Description |
|---|---|
Object handle() | The internal check instance, or null for a definition that has no live instance. |
Class<?> handleClass() | The implementing class. Always available, so you can test what you are holding. |
api.users().queryUserByName("Notch").ifPresent(user -> {
for (Check check : api.checks().of(user)) {
if (check.violationLevel() < check.setbackVl() / 2) continue;
System.out.printf("%-16s VL=%.1f setback=%.0f punish=%.0f (%s)%n",
check.name(), check.violationLevel(),
check.setbackVl(), check.punishVl(), check.stableKey());
}
});
// A definition-based lookup works with nobody online.
api.checks().byName("badpackets.duplicate_slot").ifPresent(check ->
System.out.println(check.name() + ": " + check.description()));