Class KyoriConstants

java.lang.Object
me.totalfreedom.utils.kyori.KyoriConstants

public final class KyoriConstants extends Object
This class contains different methods to provide ChatType.Bound instances for sending messages to players in game. This is now a requirement for all message requests to players due to the new chat signature system.
Even though Scissors has this feature disabled, upstream (Paper) and Kyori Adventure have made the appropriate API changes to accomodate chat signatures.
As a result, we need to conform to those specifications even if we do not use this feature.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.kyori.adventure.chat.ChatType.Bound
    A singleton ChatType.Bound for the Patchwork plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.kyori.adventure.chat.ChatType.Bound
    fromConsole(org.bukkit.command.ConsoleCommandSender sender)
    Represents a Chat Bound for the console.
    static net.kyori.adventure.chat.ChatType.Bound
    fromPlayer(org.bukkit.entity.Player player)
    Represents a Chat Bound for a player.
    static net.kyori.adventure.chat.ChatType.Bound
    fromPlugin(Class<? extends org.bukkit.plugin.java.JavaPlugin> pluginClass)
    Represents a Chat Bound for a plugin.
    static net.kyori.adventure.chat.ChatType.Bound
    fromPlugin(org.bukkit.plugin.java.JavaPlugin plugin)
     

    Methods inherited from class java.lang.Object

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

    • PATCHWORK

      public static final net.kyori.adventure.chat.ChatType.Bound PATCHWORK
      A singleton ChatType.Bound for the Patchwork plugin.
  • Method Details

    • fromPlugin

      public static net.kyori.adventure.chat.ChatType.Bound fromPlugin(Class<? extends org.bukkit.plugin.java.JavaPlugin> pluginClass)
      Represents a Chat Bound for a plugin.
      This is a convenience method so you are not required to dependency inject your plugin instance any time that you need a Bound.
      Parameters:
      pluginClass - The plugin class to get the plugin instance from.
      Returns:
      A ChatType.Bound instance for the plugin.
      See Also:
    • fromPlugin

      public static net.kyori.adventure.chat.ChatType.Bound fromPlugin(org.bukkit.plugin.java.JavaPlugin plugin)
    • fromPlayer

      public static net.kyori.adventure.chat.ChatType.Bound fromPlayer(org.bukkit.entity.Player player)
      Represents a Chat Bound for a player. Chat bounds are required for sending messages to players.
      The chat bound is a representation of a validated chat signature, which is tied directly to the user's account name. In our case, this is the player's name.
      Parameters:
      player - The player to get the bound for.
      Returns:
      A ChatType.Bound instance for the player.
    • fromConsole

      public static net.kyori.adventure.chat.ChatType.Bound fromConsole(org.bukkit.command.ConsoleCommandSender sender)
      Represents a Chat Bound for the console.
      The chat bound is a representation of a validated chat signature, which is tied directly to the user's account name. In our case, this is the player's name.
      Parameters:
      sender - The console to get the bound for.
      Returns:
      A ChatType.Bound instance for the console.