Skip to content

Integrations and API

valk edited this page Oct 2, 2026 · 1 revision

WorldGuard

With WorldGuard installed, a jukebox inside a region answers only the region's members and owners: putting a disc in or taking it out, the player screen, the queue, speaker pairing and picking it up, from a click or from /cdisc player and /cdisc pair. Region bypass still applies.

The region flag cdisc-jukebox changes that for one region:

/rg flag <region> cdisc-jukebox allow   jukeboxes open to everyone
/rg flag <region> cdisc-jukebox deny    closed to members too
# config.yml
worldguard:
  enabled: true
  deny-message: worldguard

deny-message decides who words the refusal:

  • worldguard: the region's own deny-message flag, so plugins that translate WorldGuard messages or move them to the action bar apply to it.
  • cdisc: perms.region_denied from the language file. Starting that text with actionbar! or actionbar:5! shows it in the action bar for 3 or 5 seconds instead of chat.

PlaceholderAPI

With PlaceholderAPI installed, these describe the nearest jukebox the player can hear, paired speakers included:

Placeholder Gives
%cdisc_title%, %cdisc_author% The track
%cdisc_track% author - title, or the title alone
%cdisc_position% mm:ss
%cdisc_duration%, %cdisc_remaining% mm:ss; empty for a live stream
%cdisc_progress% 0 to 100
%cdisc_listening%, %cdisc_playing%, %cdisc_paused%, %cdisc_live% PlaceholderAPI's yes / no
%cdisc_uri% The link the track came from
%cdisc_jukeboxes% How many jukeboxes are playing on the server

API for other plugins

Add the CDisc jar as a compile-only dependency and CDisc to softdepend or depend in your plugin.yml. Everything public is in dev.valkdz.cdisc.api.

Asking what is playing

import dev.valkdz.cdisc.api.CDiscApi;
import dev.valkdz.cdisc.api.NowPlaying;

CDiscApi.nowPlaying(jukeboxBlock);   // Optional<NowPlaying>
CDiscApi.audibleTo(player);          // Optional<NowPlaying>, the nearest jukebox they hear
CDiscApi.playingJukeboxes();         // Set<Block>

NowPlaying is a record: jukebox, title, author, uri, positionMs, durationMs, paused, live.

Events

All in dev.valkdz.cdisc.api.event.

Event Fired when Gives
TrackStartEvent A disc, the next in the queue, a crossfade or a repeat began getJukebox, getTitle, getAuthor, getUri, getDurationMs, isLive, getSource, getCause
PlaybackStopEvent A jukebox fell silent getJukebox
DiscCreateEvent A disc is about to be written. Cancellable getPlayer, getItem, getAddress, getTitle, getAuthor, getLengthMs
@EventHandler
public void onCreate(DiscCreateEvent e) {
    if (e.getLengthMs() > 10 * 60_000) e.setCancelled(true);
}

Folia

One jar runs on Spigot, Paper and Folia. On Folia every jukebox, hologram and screen is driven by the region that owns it.

Clone this wiki locally