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

Ultimo aggiornamento:

Accedi

Nuovo? Scrivi solo la tua email: l'account nasce quando clicchi il link. Nessuna password.

oppure

Ti mandiamo un link che ti fa entrare con un clic. Vale per account nuovi ed esistenti.

Entra con la password

Continuando accetti i Termini e condizioni e la Privacy policy.

Staff: apri “Entra con la password” e scrivi il tuo nome utente al posto dell’email. Dopo la password ti chiediamo il codice 2FA.