Lets other plugins and server mods use Crux client features (notices, HUD, dialogs, menus, keys, markers, screen effects). The classes ship inside the Crux plugin / server mod; you only compile against the Crux-API jar.
- Download Crux-API-<version>.jar from the server downloads and add it as compileOnly.
- Add softdepend: [Crux] to plugin.yml (or depend if you require it).
- Check CruxApi.available(), then use CruxApi.get(). Safe from any thread.
CruxApi crux = CruxApi.get();
crux.listen(new CruxListener() {
public void onDialog(UUID p, String dialog, String choice) {
if (dialog.equals("elder") && choice.equals("yes")) startQuest(p);
}
public void onKey(UUID p, String key) {
if (key.equals("cast")) castSpell(p);
}
});
crux.registerKey(id, "cast", "R", "Cast spell");
crux.dialog(id, CruxDialog.of("elder", "Village elder", "Will you help us?",
new CruxDialog.Choice("yes", "I'll help"), new CruxDialog.Choice("no", "Not now")));
crux.hud(id, CruxHud.bar("boss", "Ancient Golem", 0.62f, 0xE0314B));
crux.hudLive(id, "money", "Gold: %vault_eco_balance%", 2);| Method | What it does |
|---|---|
isCruxPlayer(uuid) · clientVersion(uuid) · cruxPlayers() | Crux client check · version · online Crux players |
clientInfo(uuid) | Language · GUI scale · window size (reported after joining) |
badges(uuid) | Public Crux badges (CompletableFuture) |
toast · notify | Corner pop-up · chat notice (plain chat without Crux) |
hud(uuid, id, text) · hud(uuid, CruxHud) · hudLive · clearHud | HUD text · position · colour · progress bar (boss-bar style), auto-refreshing placeholders |
registerKey · clearKeys | Key presses → onKey (up to 16) |
askText | Text box → onText |
dialog(uuid, CruxDialog) | NPC dialog with choices → onDialog |
menu(uuid, CruxMenu) · closeScreen | Button menu → onMenu |
marker · clearMarker · clearMarkers | Position markers with distance |
shake · fade | Camera shake · colour fade (cutscene transitions, flashes) |
cameraMode | Sets the follow camera (F5-like): view (first, back, front, shoulder), distance, height and side offsets. Does nothing without the Crux client. |
cameraRig · cameraOp | Player camera (API 10) — cameraRig takes a settings JSON (view follow · fixed · first, spring arm, field of view, roll, wall collision, look-at, blending); cameraOp sends one-off commands (move · release · impulse · fov · roll). Missing keys keep the player's own settings. |
blockOutline · blockFeatures · blockInput · nameTags | Block outline colour and width, blocking client features, blocking vanilla controls, and the name tag distance or hiding a player sees (API 10, per player). 0 or an empty list = the player's own settings. |
solids | Solid bodies (API 11) — rigidbody collider boxes the Crux client collides with directly, no shulker (any size, compound shapes). set = {entity UUID: boxes relative to that entity} · del · clear. Boxes follow the entity |
overlay · clearOverlay(s) | Name · level · health bar above an entity (drawn by the client instead of armor stands) |
floatingText | Rising, fading text — damage numbers · XP |
telegraph(uuid, CruxRpg.Telegraph) · clearTelegraph | Boss AoE ground warning (circle · cone · line, filling line) |
effect | Client-side particle presets ring · burst · beam · spiral (no particle packets) |
skillBar · cooldown | Skill bar above the hotbar (item · pixel icons, key, cooldown sweep) |
timer | Self-filling bar — cast bar · countdown |
subtitle | Subtitle above the hotbar |
cutscene · stopCutscene | Camera-path cutscene (onClose "camera" when done) |
music · stopMusic | Looping background music with fades (region BGM) |
registerAsset · entityModel(All) · entityModelStateAll · clear… | Server assets (model json + png) sent once and cached; models on mobs · NPCs (idle · walk · attack, replace hides the original) |
party · quest | Party frames (left) · quest tracker (right) |
recommendHud | Offers this server's HUD layout (restored on leave). Group ids: info · keystrokes · armor · effects · lookat · light · saturation · sprint · streamchat |
window(uuid, CruxWindow) · onWindow | Large window (API 5): slot grid, item counts, tooltips, side text and buttons. Sending the same id again updates the open window (stayOpen). Non-Crux players get clickable chat. Bukkit event CruxEvents.WindowClick |
track(uuid, step) | Server analytics (API 5): records reached steps (e.g. quest stages) as daily counts — only in plugins/Crux/analytics.json on this server, players distinguished only by a per-server hash. View in the launcher server window → Analytics tab |
defaultStyle(CruxStyle) · style(uuid, CruxStyle) | Server-wide and per-player screen style (presets default · fantasy · vanilla · future, accent colour, slot · button · dialog · toast · skill bar layout), layered over config "ui" — API 6 |
dialog · menu · window · askText · toast (…, CruxStyle) | Overrides the style for one screen. Build one from text too: CruxStyle.parse("fantasy grid=right accent=#C9A227") — API 6 |
hudVanilla · defaultHudVanilla | Hide or move vanilla HUD parts (hotbar, hearts, armour, food, air) — per player or server-wide, config "ui" vanillaHide · vanillaMove — API 7 |
inventoryOffset · defaultInventoryOffset | Move the inventory / chest screens up or down — per player or server-wide, config "ui" inventoryY — API 7 |
tooltips · defaultTooltips (CruxRpg.Tooltips) | Item tooltips: rarity border and line (PDC crux:rarity, MMOItems tier, vanilla rarity), Shift to compare with what is equipped — config "ui" tooltips · tooltipCompare · rarityColors — API 8 |
chatTabs · defaultChatTabs (CruxRpg.ChatTab) | Chat tabs above the chat input: split messages with a regex, chat typed in a tab becomes a command (/p {msg}), unread counts — config "ui" chatTabs — API 8 |
waypoint | Quest waypoint: marker plus light beam and an arrow at the screen edge (remove with clearMarker) — API 8 |
highlight · clearHighlight(s) | Glowing outline only this player sees (party members, targets, NPCs) with a view distance — API 8 |
areFriends(a, b) | Whether two players on this server are Crux friends — nothing else (both must allow it; needs /crux link) — API 8 |
registerSound · sound · soundAt | Server sounds without a resource pack (ogg): registerSound or the plugins/Crux/sounds folder, for one player or at a position; music() accepts the same names — API 8 |
CruxListener.onReport | Player reports from the in-game player info screen (chat to staff with crux.reports, server log, CruxListener.onReport) — API 8 |
registerKey (Controls) | Keys from registerKey appear under 'Crux server' in Minecraft Controls where players can rebind them (remembered per server) — API 8 |
available() · apiVersion() · serverVersion() | Whether Crux is installed, the installed API number (currently 9), and the Crux plugin version. Only call newer features when apiVersion() is at least that number. |
- Players without Crux: dialogs, menus and text prompts fall back to clickable chat; HUD, keys, markers and effects do nothing (return false).
- Only answers to dialogs, menus and prompts you sent reach listeners — still validate them like command arguments.
- Check apiVersion() for the installed API level (1 = detection · notices, 2 = HUD lines, 3 = everything else).
- API levels: 1 = detection · notices, 2 = HUD lines, 3 = input · screens · effects, 4 = RPG (overlays · telegraphs · skill bar · cutscenes · music · models · recommended HUD), 5 = large windows · analytics steps (track), 6 = screen styles (CruxStyle), 7 = free HUD positions · vanilla HUD · inventory offset · UI images, 8 = server sounds · tooltips · chat tabs · waypoints · highlight · friends · reports · server keys in Controls. Older Crux clients silently ignore features they do not know.
- Windows opened by a server show the server address in the top-right corner, and toasts · notices start with [Server]. Imitating official Crux messages or asking for account or payment details violates the operating policy (/policy).
- On a proxy (Velocity · BungeeCord) only notices and toasts are available (see 'Proxy API' below). Call everything else (HUD, dialogs, menus) from Crux on the backend server.
CRUX