Class Titles


  • public final 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:
    2.1.0
    Author:
    Crypto Morin
    See Also:
    ReflectionUtils
    • Method Summary

      All Methods Static Methods Concrete Methods 
      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​(String header, String footer, org.bukkit.entity.Player... players)
      Supports pre-1.13 tab method.
      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.
    • Method Detail

      • 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​(@Nonnull
                                       String header,
                                       @Nonnull
                                       String footer,
                                       org.bukkit.entity.Player... players)
        Supports pre-1.13 tab method. Changes the tablist header and footer message for a player. This is not fully completed as it's not used a lot.

        Headers and footers cannot be null because the client will simply ignore the packet.

        Parameters:
        header - the header of the tablist.
        footer - the footer of the tablist.
        players - players to send this change to.
        Since:
        1.0.0