Class BungeeMessage

java.lang.Object
com.mrivanplays.ivancord.api.command.message.BungeeMessage
All Implemented Interfaces:
com.mojang.brigadier.Message

public final class BungeeMessage extends Object implements com.mojang.brigadier.Message
Represents a BungeeCord implementation of the Brigadier's Message interface. With it, you are able to send custom messages to the command senders, using SuggestionsBuilder.suggest(String, Message)
  • Constructor Details

  • Method Details

    • createOfTranslatable

      public static BungeeMessage createOfTranslatable(String id, ChatColor color, Object... with)
      A utility method to create a BungeeMessage with a message of TranslatableComponent with the appropriate translation id
      Parameters:
      id - the translation id
      with - the Strings and BaseComponents to use in the translation
      Returns:
      new bungee message instance
    • convertSyntaxException

      public static BaseComponent convertSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException exception)
      Converts the provided CommandSyntaxException into a BungeeCord style message.
      Parameters:
      exception - the exception provided
      Returns:
      a message that could be directly sent to a CommandExecutor
    • convertContextOf

      public static TextComponent convertContextOf(com.mojang.brigadier.exceptions.CommandSyntaxException exception)
      Converts CommandSyntaxException.getContext() to a component.
      Parameters:
      exception - the exception provided
      Returns:
      converted context, or null
    • getMessage

      public BaseComponent[] getMessage()
      Returns the message provided.
      Returns:
      message
    • getString

      public String getString()
      Specified by:
      getString in interface com.mojang.brigadier.Message
    • toString

      public String toString()
      Overrides:
      toString in class Object