Class Titles

java.lang.Object
com.cryptomorin.xseries.messages.Titles
All Implemented Interfaces:
Cloneable

public final class Titles extends Object implements Cloneable
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.wiki/w/Commands/title PacketPlayOutTitle: https://wiki.vg/Protocol#Title

Version:
3.1.0
Author:
Crypto Morin
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Titles(String title, String subtitle, int fadeIn, int stay, int fadeOut)
     
  • 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 Titles
    parseTitle(org.bukkit.configuration.ConfigurationSection config)
     
    static Titles
    parseTitle(org.bukkit.configuration.ConfigurationSection config, Function<String,String> transformers)
    Parses a title from config.
    void
    send(org.bukkit.entity.Player player)
     
    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 Titles
    sendTitle(org.bukkit.entity.Player player, org.bukkit.configuration.ConfigurationSection config)
    Parses and sends a title from the config.
    void
    setSubtitle(String subtitle)
     
    void
     

    Methods inherited from class java.lang.Object

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

    • Titles

      public Titles(String title, String subtitle, int fadeIn, int stay, int fadeOut)
  • Method Details

    • clone

      public Titles clone()
      Overrides:
      clone in class Object
    • send

      public void send(org.bukkit.entity.Player player)
    • 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:
    • 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

      public static Titles sendTitle(@Nonnull org.bukkit.entity.Player player, @Nonnull org.bukkit.configuration.ConfigurationSection config)
      Parses and sends a title from the config.
      Parameters:
      player - the player to send the title to.
      config - the configuration section to parse the title properties from.
      Since:
      1.0.0
    • parseTitle

      public static Titles parseTitle(@Nonnull org.bukkit.configuration.ConfigurationSection config)
    • parseTitle

      public static Titles parseTitle(@Nonnull org.bukkit.configuration.ConfigurationSection config, @Nullable Function<String,String> transformers)
      Parses a title from config. The configuration section must at least contain title or subtitle

      Example:

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

      public String getTitle()
    • getSubtitle

      public String getSubtitle()
    • setTitle

      public void setTitle(String title)
    • setSubtitle

      public void setSubtitle(String subtitle)
    • 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