RA-AiAntiCheat
Author: RajaAditya Website: rajaaditya.my.id Version: 1.0.0 API: Paper 1.20.x (Java 17+)
Features
Statistical X-Ray Detection
The plugin watches how players find valuable ores and builds a suspicion score from five factors, each with its own points and switch:
| Factor | What it looks for |
|---|---|
| Beeline | Digging in a straight line toward an ore |
| Exposure | Finding an ore with no air cavity nearby |
| Interval | Finding ores in very short intervals |
| Y-level efficiency | Mining exactly at the best Y level for that ore |
| Direction change | Sudden turns toward an ore |
Tracked ores include diamond, ancient debris, emerald, and gold, and the list is configurable.
Fair Scoring
- Sliding window: the score is recalculated from events in the last N days (default 7), not accumulated for life. A player who stops suspicious mining slowly drops back down
- Exposed-ore immunity: an ore found in an area that was already open (cave, ravine, surface) gets zero points, since normal cave exploring also finds ores fast and precisely. The score only grows from ores found in solid stone with no exposure
- Self-mined path: blocks the player just broke to reach an ore are remembered for 30 seconds and not counted as exposure
- Players and worlds can be excluded, and
raanticheat.bypassskips monitoring
Three Tiers
| Tier | Default score | Default action |
|---|---|---|
| Low | 30 | LOG_ONLY |
| Medium | 60 | DISCORD_ALERT |
| High | 90 | FLAG_FOR_REVIEW |
Alerts are sent when a player moves up a tier, and repeated every N new ores while they stay in an alert tier (realert-every-ores).
Discord Alerts
- Alert embeds for the medium and high tiers are fully customizable: title, description, color, thumbnail, author, fields, footer, and whether to mention a staff role
- Embed placeholders:
{player},{score},{ore_count},{tier},{window_days},{location},{world},{x},{y},{z},{material}
AI Staff Assistant
- A Discord bot (built in with JDA) answers questions from staff in one staff channel, using the Gemini API
- Talk to it by mentioning the bot or with the
!aiprefix, for example!ai why was Budi flagged? - It reads the score breakdown and compares it to the server average, and its personality and rules are in
persona.yml - It only advises. Nothing is ever banned automatically, and the final decision stays with staff
Dependencies
| Component | Required | Purpose |
|---|---|---|
| Discord bot token | For Discord features | Created in the Discord Developer Portal. Enable Message Content Intent |
| Gemini API key | For the AI assistant | Free from Google AI Studio |
Storage is a local SQLite file.
Installation
- Place
RA-AiAntiCheat.jarinto yourplugins/folder - Start the server once to generate
config.ymlandpersona.yml - In the
discordsection, fill in the bot token,staff-chat-channel-id,alert-channel-id, and optionallymention-role-id - Put your Gemini key in
gemini.api-key - Invite the bot with the scope
botand the permissions Send Messages, Read Message History, and View Channel - Run
/raac reload. A changed Discord token needs a full restart because the bot connects only once on enable
config.yml and persona.yml can hold tokens and keys. Never commit them to a public repository, and add them to .gitignore if your server folder is versioned.
File Structure
plugins/RA-AiAntiCheat/
├── config.yml # Scoring, thresholds, Discord, Gemini
├── persona.yml # The assistant's name, personality, and rules
└── aianticheat_data.db # SQLite: raw ore events and scores
Configuration
config.yml
settings:
log-raw-events: true
evaluation-interval-seconds: 300
min-ore-sample-size: 5
suspicion-window-days: 7
realert-every-ores: 5 # 0 = alert once per tier increase only
self-mine-memory-seconds: 30
tracked-ores:
- DIAMOND_ORE
- DEEPSLATE_DIAMOND_ORE
- ANCIENT_DEBRIS
- EMERALD_ORE
- GOLD_ORE
scoring:
beeline:
enabled: true
threshold: 0.75
points: 15
exposure:
enabled: true
check-radius: 2
points: 20
exposed-ore-immunity: true
interval:
enabled: true
min-seconds-between-ore: 4
points: 10
y-level-efficiency:
enabled: true
optimal-y:
DIAMOND_ORE: -58
ANCIENT_DEBRIS: 15
tolerance: 3
points: 10
direction-change:
enabled: true
points: 15
thresholds:
low: { score: 30, action: LOG_ONLY }
medium: { score: 60, action: DISCORD_ALERT }
high: { score: 90, action: FLAG_FOR_REVIEW }
database:
file: "aianticheat_data.db"
retention-days: 30 # never lower than suspicion-window-days
excluded-players: []
excluded-worlds:
- "creative"
- "build"
discord:
enabled: true
bot-token: "YOUR_BOT_TOKEN"
staff-chat-channel-id: "YOUR_CHANNEL_ID"
alert-channel-id: "YOUR_CHANNEL_ID"
mention-role-id: "YOUR_ROLE_ID"
command-prefix: "!ai"
gemini:
api-key: "YOUR_GEMINI_KEY"
model: "gemini-2.0-flash"
The discord.embeds.medium and discord.embeds.high sections hold the embed layout, with color as a hex value ("#FF0000"), fields as a list you can add to or reorder, and mention-role: true or false per tier.
Tune the numbers in scoring and thresholds after looking at a few days of real data, because a legitimate baseline differs between servers. optimal-y is set for 1.18+ ore generation, so change it if your world uses another generator.
Resetting a player
If staff check a flagged player and it was a false positive, run /raac reset <player> to erase their whole history and score.
Commands
| Command | Description | Access |
|---|---|---|
/raac reload | Reload config.yml and persona.yml | Admin |
/raac check <player> | Check a player's current status | Admin |
/raac score <player> | Show a player's suspicion score | Admin |
/raac reset <player> | Delete a player's history and score | Admin |
In Discord (staff channel only)
@Nova check Steve
!ai why was Budi flagged?
The bot answers only in the configured staff channel and ignores every other channel.
Permissions
| Permission | Default | Description |
|---|---|---|
raanticheat.admin | op | Use /raac |
raanticheat.bypass | false | Skip x-ray monitoring |
License
Developed by RajaAditya — rajaaditya.my.id