Class Titles

java.lang.Object
com.cryptomorin.xseries.messages.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.wiki/w/Commands/title PacketPlayOutTitle: https://minecraft.wiki/w/Protocol#Title

Version:
4.0.1
Author:
Crypto Morin
See Also:
  • Constructor Details

    • Titles

      public Titles(MessageComponents.MessageText title, MessageComponents.MessageText subtitle, int fadeIn, int stay, int fadeOut)
    • Titles

      public Titles(net.md_5.bungee.api.chat.BaseComponent title, net.md_5.bungee.api.chat.BaseComponent subtitle, int fadeIn, int stay, int fadeOut)
    • Titles

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

    • copy

      public Titles copy()
    • send

      public void send(org.bukkit.entity.Player player)
    • sendTitle

      public static void sendTitle(@NotNull @NotNull org.bukkit.entity.Player player, int fadeIn, int stay, int fadeOut, @Nullable @Nullable String title, @Nullable @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(@NotNull @NotNull org.bukkit.entity.Player player, int fadeIn, int stay, int fadeOut, @Nullable @Nullable MessageComponents.MessageText title, @Nullable @Nullable MessageComponents.MessageText subtitle)
    • sendTitle

      public static void sendTitle(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String title, @NotNull @NotNull 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(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull 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(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection config)
    • parseTitle

      public static Titles parseTitle(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection config, @Nullable @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 MessageComponents.MessageText getTitle()
    • getSubtitle

      public MessageComponents.MessageText getSubtitle()
    • setTitle

      public void setTitle(String title)
    • setSubtitle

      public void setSubtitle(String subtitle)
    • setTitle

      public void setTitle(net.md_5.bungee.api.chat.BaseComponent title)
    • setSubtitle

      public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent subtitle)
    • clearTitle

      public static void clearTitle(@NotNull @NotNull 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(@NotNull @NotNull String header, @NotNull @NotNull 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