Skip to main content

Developer API

With the API you can control shows from your own plugin, react to shows starting and ending, and add your own triggers.

The full reference is in the JavaDoc.

Add the dependency​

Maven

<repositories>
<repository>
<id>sbdevelopment-repo-releases</id>
<url>https://repo.sbdevelopment.tech/releases</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>tech.sbdevelopment</groupId>
<artifactId>ShowControl</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

Gradle (Kotlin)

repositories {
maven("https://repo.sbdevelopment.tech/releases")
}

dependencies {
compileOnly("tech.sbdevelopment:ShowControl:2.0")
}

Then add ShowControl as a dependency in your plugin.yml, so it loads before your plugin:

depend: [ ShowControl ]

Control shows​

SCAPI is the entry point. It finds, creates and deletes shows.

import tech.sbdevelopment.showcontrol.api.SCAPI;

SCAPI.getShow("finale").ifPresent(show -> show.start());
SCAPI methodWhat it does
getShow(name)The show, as an Optional<Show>
exists(name)Whether a show exists
getShowsMap()All shows by name
create(name)Create an empty show
delete(name)Delete a show and its schedules
rename(name, newName)Rename a show
getTrigger(data)Create a trigger from text, like "flame @stage height:6"
Show methodWhat it does
start()Start from the beginning
start(fromMillis, loop)Start from a time, optionally on repeat. Returns false if a listener cancelled it.
pause() / resume()Pause or continue
stop()Stop the show
isRunning() / isPaused()Current status
getCurrentTime()Current show time in milliseconds
getDuration()Time of the last cue in milliseconds
getCuePoints()All cues, sorted by time
addCue(millis, trigger)Add a cue. The show is saved right away.
removePoint(cue)Remove a cue

Call all methods from the main server thread.

Example: add a cue from code​

Show show = SCAPI.getShow("finale").orElseThrow();
Trigger flame = SCAPI.getTrigger("flame @stage height:6 duration:2s");
show.addCue(12_500, flame); // at 12.5 seconds

getTrigger throws an exception when the text is not valid. Use SCAPI.describeError(exception) to get a readable message.

Next​