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

Actualizat ultima data pe

Autentificare

Esti nou? Scrie doar emailul: contul se creeaza cand apesi pe link. Nu ai nevoie de parola.

sau

Iti trimitem un link care te autentifica dintr-un click. Merge si pentru conturi noi, si pentru cele existente.

Autentifica-te cu parola
Ai uitat parola?

Continuand, accepti Termeni si conditii si Politica de confidentialitate.

Staff: deschide „Autentifica-te cu parola” si scrie numele de utilizator in loc de email. Dupa parola iti cerem codul 2FA.