Reference

Developer API and events

Add mcScreens as softdepend in your plugin.yml and compile against the jar (provided scope).

McScreensAPI api = McScreensAPI.get(); // null when mcScreens is not enabled
api.playScreen(player, "victory", Map.of());
api.playEffect(player, "tint", 60, Map.of("color", "#FF0000"));
api.playAnimation(player, "confetti", 0);
api.playCutscene(List.of(p1, p2), "boss_entrance");
api.toast(player, "reward", Map.of("reward", "500 coins"));
api.toast(player, new ItemStack(Material.DIAMOND), "<aqua>Rare find!", "You found a diamond", "goal", "ui.pop");
api.transition(player, "iris", destination, () -> player.sendMessage("Arrived"));
api.countdown(player, 10, "event");
api.sound(player, "ui.levelup", 1f, 1f);
api.titleCard(player, "<gold>Chapter II", "The Storm", 10, 60, 20);
api.stop(player);

McScreensAPI#

  • playScreen(Player, String screen, Map<String, String> vars): a screen from screens.yml; {key} in its texts is filled from vars.
  • playEffect(Player, String effect, int durationTicks, Map<String, String> options): 0 ticks = its own duration.
  • playAnimation(Player, String animation, int ticks): 0 = its own length.
  • playCutscene(Collection<Player>, String cutscene): several players watch as one group.
  • toast(Player, String id, Map<String, String> vars) and toast(Player, ItemStack icon, String title, String text, String frame, String sound).
  • transition(Player, String transition, Location to, Runnable afterTeleport): to may be null for only the animation.
  • countdown(Player, int seconds, String style), sound(Player, String id, float volume, float pitch), titleCard(Player, String title, String subtitle, int fadeIn, int stay, int fadeOut) (ticks).
  • stop(Player), inCutscene(Player), animations(), effects(), cutscenes().

Events#

In dev.technotypist.mcscreens.api.event:

  • ScreenStartEvent (cancellable): getPlayer(), getScreen().
  • ToastShowEvent (cancellable): getPlayer(), getTitle() / setTitle(), getText() / setText().
  • CutsceneStartEvent (cancellable): getViewers() (editable), getCutscene().
  • CutsceneSkipEvent (cancellable): getPlayer(), getCutscene().
  • CutsceneEndEvent: getViewers(), getCutscene(), isSkipped().
@EventHandler
public void onToast(ToastShowEvent e) {
    e.setText(e.getText() + " <gray>(+10 xp)");
}