Skip to content

api title

Puharesource edited this page Dec 9, 2014 · 5 revisions

Title Object

TitleObject.java controls everything to do with the floating messages on your screen.

Simple example title functions

This will simply show a given title and subtitle on the players screen.

void sendFloatingText(Player player, String title, String subtitle) {
  new TitleObject(title, subtitle).send(player);
}

This will show a given title (without a subtitle) on the players screen, with a given fade in, stay and fade out time.

void sendFloatingText(Player player, String title, int fadeIn, int stay, int fadeOut) {
  new TitleObject(title, TitleObject.TitleType.TITLE).setFadeIn(fadeIn).setStay(stay).setFadeOut(fadeOut).send(player);
}
Simple example event
@EventHandler
public void onTitleSend(TitleEvent event) {
  if (true)
    event.setCancelled(true);
  else event.setCancelled(false);
}

Clone this wiki locally