TMDevelopmentTinulica & Maiky

Developer API

Developer API

Add ScreenFX to the dependencies of your paper-plugin.yml (or softdepend in plugin.yml), then:

ScreenFXAPI api = ScreenFX.api(); // also in the Bukkit ServicesManager

EffectHandle stun = api.play(player, "flashbang");                    // a preset
EffectHandle scene = api.play(player, "cinematic", Duration.ofSeconds(10));
EffectHandle blur = api.apply(player, Key.key("minecraft:blur"), Duration.ofSeconds(5), "myplugin:stun");

stun.cancel();                        // removes only what this handle added
api.clear(player, "myplugin:stun");   // stops a channel
api.stop(player, "cinematic");        // stops a preset
api.clearAll(player);                 // everything ScreenFX shows to the player
Method
play(player, preset) · play(player, preset, duration)start a preset (the duration overrides its own)
apply(player, effect, duration, channel)one effect on your own channel; Duration.ZERO = until cancelled
stop(player, preset) · clear(player, channel) · clearAll(player)stop runs; they return how many
active(player)the running handles, oldest first
hasPack(player)the player loaded the ScreenFX resource pack
canSeeEffects(player)Java 26.3+ client
presets() · isPreset(id)
playScene(player, scene)start a cutscene of scenes.yml; true if it starts
stopScene(player)end the player's cutscene; true if he was watching one
watchingScene(player)the cutscene the player watches, or null
scenes()ids of every cutscene
startShow(show) · stopShow(show)start a show of shows.yml (false if there is no such show) · stop it (false if it was not running)
intensity(player)the player's intensity: soft, normal or strong
cameraMovement(player)false if the player turned the camera movement off
api.playScene(player, "intro");
api.startShow("party_time");

EffectHandle: player(), preset(), channel(), origin(), isActive(), remainingTicks(), cancel().

Every method can be called from any thread: the work moves to the player's thread by itself. Players who turned effects off, players with screenfx.exempt and clients that can't show effects are respected like for commands.

Events

Event
ScreenFXPresetStartEventa preset starts (cancellable)
ScreenFXPresetEndEventa preset ends, with the reason
ScreenFXEffectApplyEventan effect is applied (cancellable)
ScreenFXToggleEventa player turns effects or flashing effects on or off
ScreenFXSceneStartEventa cutscene starts for a player (cancellable)
ScreenFXSceneEndEventa cutscene ends for a player

Last updated

Sign in

New here? Just enter your email: the account is created when you click the link. No password needed.

or

We send you a link that signs you in with one click. It works for new and existing accounts.

Sign in with a password instead

By continuing you accept the Terms & Conditions and the Privacy policy.

Staff: open “Sign in with a password instead” and type your username instead of the email. After the password we ask for your 2FA code.