Class Titles

java.lang.Object
com.cryptomorin.xseries.messages.Titles

public class Titles
extends Object
A reflection API for titles in Minecraft. Fully optimized - Supports 1.8.8+ and above. Requires ReflectionUtils. Messages are not colorized by default.

Titles are text messages that appear in the middle of the players screen: https://minecraft.gamepedia.com/Commands/title PacketPlayOutTitle: https://wiki.vg/Protocol#Title

Version:
1.0.2
Author:
Crypto Morin
See Also:
ReflectionUtils
  • Constructor Summary

    Constructors 
    Constructor Description
    Titles()  
  • Method Summary

    Modifier and Type Method Description
    static void clearTitle​(org.bukkit.entity.Player player)
    Clears the title and subtitle message from the player's screen.
    static void sendTabList​(org.bukkit.entity.Player player, String header, String footer)
    Changes the tablist header and footer message for a player.
    static void sendTitle​(org.bukkit.entity.Player player, int fadeIn, int stay, int fadeOut, String title, String subtitle)
    Sends a title message with title and subtitle to a player.
    static void sendTitle​(org.bukkit.entity.Player player, String title, String subtitle)
    Sends a title message with title and subtitle with normal fade in, stay and fade out time to a player.
    static void sendTitle​(org.bukkit.entity.Player player, org.bukkit.configuration.ConfigurationSection config)
    Parses and sends a title from the config.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • sendTitle

      public static void sendTitle​(@Nonnull org.bukkit.entity.Player player, int fadeIn, int stay, int fadeOut, @Nullable String title, @Nullable String subtitle)
      Sends a title message with title and subtitle to a player.
      Parameters:
      player - the player to send the title to.
      fadeIn - the amount of ticks for title to fade in.
      stay - the amount of ticks for the title to stay.
      fadeOut - the amount of ticks for the title to fade out.
      title - the title message.
      subtitle - the subtitle message.
      Since:
      1.0.0
      See Also:
      clearTitle(Player)
    • sendTitle

      public static void sendTitle​(@Nonnull org.bukkit.entity.Player player, @Nonnull String title, @Nonnull String subtitle)
      Sends a title message with title and subtitle with normal fade in, stay and fade out time to a player.
      Parameters:
      player - the player to send the title to.
      title - the title message.
      subtitle - the subtitle message.
      Since:
      1.0.0
      See Also:
      sendTitle(Player, int, int, int, String, String)
    • sendTitle

      public static void sendTitle​(@Nonnull org.bukkit.entity.Player player, @Nonnull org.bukkit.configuration.ConfigurationSection config)
      Parses and sends a title from the config. The configuration section must at least contain title or subtitle

      Example:

           ConfigurationSection titleSection = plugin.getConfig().getConfigurationSection("restart-title");
           Titles.sendTitle(player, titleSection);
       
      Parameters:
      player - the player to send the title to.
      config - the configuration section to parse the title properties from.
      Since:
      1.0.0
    • clearTitle

      public static void clearTitle​(@Nonnull org.bukkit.entity.Player player)
      Clears the title and subtitle message from the player's screen.
      Parameters:
      player - the player to clear the title from.
      Since:
      1.0.0
    • sendTabList

      public static void sendTabList​(org.bukkit.entity.Player player, String header, String footer)
      Changes the tablist header and footer message for a player. This is not fully completed as it's not used alot.
      Parameters:
      player - the player to change the tablist for.
      header - the header of the tablist.
      footer - the footer of the tablist.
      Since:
      1.0.0