RA-RaceBoatEvent

An admin-controlled multi-arena boat racing event plugin for Paper 1.21.x, with gate-based lap detection, live bossbar/actionbar HUD, cross-session stats, and Discord webhook results.

Author: RajaAditya Website: rajaaditya.my.id Version: 1.0.0 API: Paper 1.21.x


Features

Multi-Arena Event System

  • Create unlimited independent racing arenas (/race create <event>)
  • Each arena tracks its own lobby, boat spawns, checkpoints, and registration state
  • Multiple arenas can run concurrent sessions at the same time

Gate-Based Lap Detection

  • Start/finish line and checkpoints are defined as cuboid regions (selected with a wand), not single points
  • Detection checks the boat's full swept hull path between ticks (not just its instantaneous position), so a fast boat can't skip a thin gate between two ticks
  • Configurable padding tolerance so a boat resting exactly on a gate's boundary still registers as a pass
  • Checkpoints must be hit strictly in order — an anti-shortcut measure before the lap counts at the finish line

Full Race Lifecycle

  • Registration (/race daftar) → Join arena (/race masuk) → Countdown → Running → Finished
  • Players are locked in place (movement, inventory, block break/place, item drop/pickup, attacks) while waiting/counting down
  • Admins can pause, resume, force-stop, or disqualify (dq) a player mid-race

Live HUD

  • BossBar showing arena, session name, current lap, and remaining time
  • ActionBar showing current lap / total, best lap, live position, and next checkpoint
  • Both are independently toggleable via config

Cross-Session Player Stats

  • Total races, wins, total laps, and all-time best lap persisted per player, per arena
  • Backed by YAML (default, zero setup), SQLite, or MySQL (via HikariCP)
  • Viewable in-game with /race stats

Discord Webhook Results

  • Posts the top-N leaderboard to a Discord webhook automatically when a round finishes
  • Fully customizable: bot username/avatar, embed color, title/footer text (with placeholders), leaderboard size, and an optional mention/content line

PlaceholderAPI Support

  • Exposes live race data as placeholders for use in scoreboard/tab plugins (e.g. TAB) — this plugin does not render its own scoreboard
  • Supports both explicit-arena and player-context shorthand syntax

Fully Configurable

  • All arena setup, timers, HUD, checkpoint tolerance, storage backend, and Discord options configurable via YAML
  • /race reload reloads config and messages without restarting the server

Dependencies

PluginRequiredPurpose
PlaceholderAPINo (softdepend)Enables %raceevent_*% placeholders

No hard dependencies — the plugin runs standalone with YAML storage and Discord/PAPI disabled by default.


Installation

  1. Place RA-RaceBoatEvent.jar into your plugins/ folder
  2. Restart the server
  3. Edit config.yml / messages.yml in plugins/RA-RaceBoatEvent/ to your liking
  4. Use /race reload to apply config changes without restarting
  5. Set up your first arena — see Arena Setup Walkthrough below

File Structure

text
1
plugins/RA-RaceBoatEvent/
├── config.yml       # Storage backend, race timers, HUD, checkpoint tolerance, Discord webhook
├── messages.yml      # All plugin messages, prefix, bossbar/actionbar formats
├── arenas/           # One YAML file per arena (lobby, spawns, checkpoints, boat slots)
├── stats.yml          # Player stats, only used when storage.type = YAML
├── stats.db           # SQLite database, only used when storage.type = SQLITE
└── plugin.yml         # Plugin metadata

Configuration

config.yml

yaml
1
storage:
  # type: YAML | SQLITE | MYSQL
  type: YAML
  mysql:
    host: localhost
    port: 3306
    database: raceboatevent
    username: root
    password: ""
    useSSL: false

race:
  # Countdown before GO! (seconds)
  countdown-seconds: 5
  # How many checkpoints must be passed in-order before a lap counts
  require-checkpoints-in-order: true
  # Ticks between anti-cheat re-lock enforcement while waiting
  lock-check-interval-ticks: 5
  # Auto despawn boats this many ticks after a player leaves/finishes
  boat-despawn-delay-ticks: 20
  # Extra tolerance (in blocks) added around checkpoint/start-finish gate
  # boxes when checking if a boat passed through. Boats commonly float with
  # their hull resting exactly on the gate's boundary, which an exact
  # (un-padded) box check can miss - raise these if checkpoints still feel
  # unreliable, lower them if gates are triggering too early/far away.
  checkpoint-vertical-padding: 0.6
  checkpoint-horizontal-padding: 0.1

bossbar:
  enabled: true

actionbar:
  enabled: true
  update-interval-ticks: 10

whitelisted-commands:
  - "/race info"
  - "/race stats"
  - "/race keluar"

discord:
  # Kirim leaderboard top 1-10 tiap ronde selesai ke Discord via webhook.
  enabled: false
  webhook-url: ""
  # Nama & avatar bot yang tampil di Discord (kosongkan untuk pakai default webhook).
  username: "Boat Race"
  avatar-url: ""
  # Warna garis samping embed, format hex "#RRGGBB".
  embed-color: "#FFC800"
  # Judul & footer embed. Placeholder: %arena% %round% %laps%
  title: "🏁 Hasil Ronde: %round% (%arena%)"
  footer: "Boat Race Event"
  footer-icon-url: ""
  # Jumlah baris leaderboard yang dikirim (maks 25, batas embed Discord).
  top-limit: 10
  # Isi pesan di luar embed, misal mention role. Kosongkan untuk tidak ada mention.
  # Contoh mention role: "<@&123456789012345678>"
  content: ""

Config fields:

FieldDescription
storage.typeYAML (flat-file, default), SQLITE, or MYSQL — see Stats Storage
race.countdown-secondsSeconds counted down before a session begins
race.require-checkpoints-in-orderEnforces strict checkpoint order before a lap counts
race.lock-check-interval-ticksHow often the anti-cheat re-locks players stuck in WAITING/COUNTDOWN
race.boat-despawn-delay-ticksDelay before a vacated/finished boat entity is removed
race.checkpoint-vertical-padding / checkpoint-horizontal-paddingTolerance (in blocks) added to gate hitboxes — see Checkpoint Detection
bossbar.enabled / actionbar.enabledToggle the live HUD elements independently
whitelisted-commandsCommands players may still run while locked during a race
discord.*See Discord Webhook

messages.yml

All player-facing text, fully translatable. Supports & color codes.

yaml
1
prefix: "&8[&cRaceEvent&8] &r"

general:
  no-permission: "&cKamu tidak memiliki izin untuk melakukan ini."
  player-only: "&cCommand ini hanya bisa digunakan oleh player."
  unknown-command: "&cCommand tidak dikenali. Gunakan /race untuk melihat bantuan."
  arena-not-found: "&cEvent '%arena%' tidak ditemukan."
  arena-already-exists: "&cEvent '%arena%' sudah ada."

admin:
  race-started: "&aRace '%arena%' ronde &f%round% &adimulai selama %duration%."
  # ...full admin.* feedback messages for every /race admin subcommand

player:
  lap-completed: "&aLap %lap% selesai! &7(%time%)"
  new-best-lap: "&6&lBEST LAP BARU! &e%time%"
  # ...full player.* messages: registration, join/leave, lock feedback, DQ, spectator

countdown:
  go: "&a&lGO!!"

bossbar:
  format: "&e%arena% &7| Session: &f%session% &7| Lap: &f%lap% &7| Sisa Waktu: &f%time%"

actionbar:
  format: "&7Lap &f%currentlap%/%totallap% &7| Best &f%bestlap% &7| Pos &f%position% &7| CP &f%checkpoint%"

Available placeholders in messages:

PlaceholderAvailable In
%arena%most admin/player messages
%player%dq-other
%id%checkpoint-added, checkpoint-removed, boat-set
%amount%maxplayer-set
%status%registration-toggled, allowjoin-toggled
%current% / %max%registered, event-full
%old% / %new%arena-renamed
%round% / %duration%race-started
%lap% / %time%lap-completed, new-best-lap
%session%, %lap%, %time%bossbar.format
%currentlap%, %totallap%, %bestlap%, %position%, %checkpoint%actionbar.format

Arena Data Files

Each arena created with /race create is saved as its own YAML file under plugins/RA-RaceBoatEvent/arenas/, containing:

FieldDescription
lobby / spawnReturn locations set via /race setlobby and /race setspawn
start lineCuboid region (pos1/pos2) set via /race setstartline
checkpointsMap of id → cuboid region, added via /race checkpoint add
boat spawnsPer-slot spawn locations set via /race setboat <event> <id>
max players / registration-open / allow-joinArena settings toggled via commands

You normally never need to hand-edit these — all fields are written by the in-game setup commands.


Arena Setup Walkthrough

  1. /race create nurburgring — create the arena
  2. Stand at the lobby spot → /race setlobby nurburgring
  3. Stand at the return/spawn spot → /race setspawn nurburgring
  4. /race givewand — get the selection wand (left-click = pos1, right-click = pos2)
  5. Select a cuboid across the start/finish line → /race setstartline nurburgring
  6. Select a cuboid across each gate along the track, in the order boats should pass them → /race checkpoint add nurburgring (repeat per checkpoint)
  7. Stand at each boat's starting position → /race setboat nurburgring <slot_id> (repeat per boat slot)
  8. /race maxplayer nurburgring <amount>
  9. /race pendaftaran nurburgring true — open registration
  10. /race allowjoin nurburgring true — allow joining the arena once registered
  11. When ready: /race start nurburgring <durasi> <nama_ronde> (e.g. /race start nurburgring 5m Semifinal)

Checkpoint Detection

Start line and checkpoints are cuboid regions, not single points — admins select an area with the wand instead of pinpointing an exact block.

  • Detection checks the boat's full hull bounding box, swept across its movement since the last tick, against the target gate's box. This prevents a fast boat from skipping a thin gate entirely between two ticks.
  • Checkpoints must be passed in strict order (race.require-checkpoints-in-order) — jumping ahead to a later gate does not advance progress, and the finish line only counts once every checkpoint has registered.
  • race.checkpoint-vertical-padding / checkpoint-horizontal-padding expand the gate's hitbox by that many blocks in each direction. This matters because a boat's hull commonly rests with its bottom face exactly on a gate's boundary (e.g. a gate built at water-surface level) — an exact, un-padded box check can miss that as "touching but not overlapping." Raise these values if checkpoints still feel unreliable on your track; lower them if gates trigger too early or from too far away.

Debugging a checkpoint that won't trigger

/race checkdebug <event> toggles a live diagnostic log for that arena. While enabled, every tick prints each racer's swept hull box next to the target gate's box (world, X/Y/Z ranges, and whether it counted as a hit) to console — useful for spotting a gate built at the wrong height or in the wrong world without guessing.

text
1
[CPDEBUG][nurburgring] CP#1 player=RajaAditya hit=false worldMatch=OK | boatBox world=world x[10.2,11.6] y[63.1,63.7] z[5.0,6.4] | regionBox world=world x[10.0,14.0] y[65.0,68.0] z[5.0,6.0]

Commands

CommandDescriptionAccess
/race create <event>Create a new arenaAdmin
/race delete <event>Delete an arenaAdmin
/race rename <old> <new>Rename an arenaAdmin
/race setlobby <event>Set the arena's lobby location to your positionAdmin
/race setspawn <event>Set the arena's return location to your positionAdmin
/race givewandGet the pos1/pos2 selection wandAdmin
/race setstartline <event>Set the start/finish line from your current wand selectionAdmin
/race checkpoint add <event>Add a checkpoint gate from your current wand selectionAdmin
/race checkpoint remove <event> <id>Remove a checkpoint by IDAdmin
/race setboat <event> <id>Set boat slot <id>'s spawn to your positionAdmin
/race maxplayer <event> <jumlah>Set the max number of participantsAdmin
/race pendaftaran <event> true|falseOpen/close registrationAdmin
/race allowjoin <event> true|falseAllow/disallow joining the arenaAdmin
/race start <event> <durasi> <nama_ronde>Start a session (e.g. 5m, 1h30m)Admin
/race pause <event>Pause a running sessionAdmin
/race resume <event>Resume a paused sessionAdmin
/race stop <event>Force-stop a sessionAdmin
/race dq <event> <player>Disqualify a player from the running sessionAdmin
/race checkdebug <event>Toggle checkpoint/start-line diagnostic loggingAdmin
/race reloadReload config and messagesAdmin
/race daftar <event>Register for an eventPlayer
/race batal <event>Cancel your registrationPlayer
/race masuk <event>Join the arena (must be registered)Player
/race keluarLeave the arena (only before the race starts)Player
/race info [event]Show arena status, participant count, and current leaderEveryone
/race statsShow your personal stats for your current/first arenaPlayer
/race spectatorToggle spectator mode while inside an arenaPlayer

Sub-commands are hidden from tab suggestions if the sender does not have raceevent.admin.


Permissions

PermissionDefaultDescription
raceevent.adminopAccess to all /race admin sub-commands (arena setup, race control, reload)
raceevent.usetrueAccess to player /race sub-commands (daftar, masuk, info, stats, etc.)

Player Lifecycle & Locking

While a player is inside an arena and the session is WAITING or COUNTDOWN, they are locked in place:

Locked ActionBehavior
MovementCancelled — player stays at their boat spawn until GO!
Exiting the boatBlocked while the race is RUNNING — use /race keluar (before start) or /race dq (mid-race) instead
Inventory / item drop / item pickupBlocked entirely
AttackingBlocked
Block break / placeBlocked
CommandsBlocked, except entries in whitelisted-commands

Once RUNNING, movement and boat control unlock and checkpoint/lap detection begins. A periodic re-lock check (race.lock-check-interval-ticks) guards against players who manage to slip loose during WAITING/COUNTDOWN.


Stats Storage

Cross-session player stats (total races, wins, total laps, all-time best lap) are tracked per player, per arena, independently of the live in-progress race state.

BackendSetupNotes
YAML (default)NoneFlat file at stats.yml, read/written on demand
SQLITENoneLocal file stats.db, single-writer connection pool
MYSQLFill in storage.mysql.* in config.ymlPooled via HikariCP, auto-creates the race_stats table on first run

Stats are recorded automatically at the end of every session for each finisher, and viewable in-game with /race stats.


Discord Webhook

When discord.enabled: true and a valid discord.webhook-url is set, the top-N leaderboard (medal emoji for 1st–3rd, #N after) is posted to Discord automatically every time a round finishes.

Customizable via config.yml:

FieldDescription
username / avatar-urlOverride the webhook's bot name/avatar (blank = use the webhook's own default)
embed-colorEmbed sidebar color, hex "#RRGGBB"
title / footer (+footer-icon-url)Embed title/footer text — supports %arena%, %round%, %laps% placeholders
top-limitNumber of leaderboard rows sent (max 25, Discord's embed limit)
contentPlain text sent outside the embed, e.g. a role mention like <@&123456789012345678>

The HTTP request runs off the main thread and fails silently into the console log (no in-game message) if the webhook URL is unreachable or Discord returns an error status.


PlaceholderAPI

Requires PlaceholderAPI to be installed. Identifier: raceevent.

Format: %raceevent_<arena>_<stat>% — e.g. %raceevent_nurburgring_currentlap%

Shorthand: %raceevent_<stat>% resolves using whichever arena the requesting player is currently inside.

StatDescription
stateArena's current RaceState (IDLE, WAITING, COUNTDOWN, RUNNING, PAUSED, FINISHED)
sessionCurrent round name
sessionnumberSession counter for the arena
registeredNumber of registered players
maxplayersMax participant slots
remainingtimeTime left in the session, HH:MM:SS
leaderName of the player currently in the lead
currentlapRequesting player's current lap
bestlap / lastlap / averagelapRequesting player's lap times
checkpointRequesting player's next checkpoint index
totalcheckpointTotal checkpoints configured for the arena
boatnumberRequesting player's assigned boat slot
positionRequesting player's live race position

Race Lifecycle States

StateMeaning
IDLENo session active (registration may still be open)
WAITINGPlayers may /race masuk, but boats are locked pending admin /race start
COUNTDOWN5..4..3..2..1..GO! in progress
RUNNINGRace is live — boats unlocked, lap/checkpoint detection active
PAUSEDTemporarily paused by an admin
FINISHEDSession ended (time up or force-stopped); results/cleanup in progress

License

Developed by RajaAditya — rajaaditya.my.id