Class MessageUtils.MessageBuilder

java.lang.Object
com.minecolonies.api.util.MessageUtils.MessageBuilder
Enclosing class:
MessageUtils

public static class MessageUtils.MessageBuilder extends Object
Starting class for the message building. Contains primary logic for sending the messages.
  • Method Details

    • withPriority

      @NotNull public @NotNull MessageUtils.MessageBuilder withPriority(MessageUtils.MessagePriority priority)
      Set the priority of this message, defaults to MessageUtils.MessagePriority.NORMAL.
      Parameters:
      priority - the new priority.
      Returns:
      the new message builder object.
    • withClickEvent

      public MessageUtils.MessageBuilder withClickEvent(@NotNull @NotNull net.minecraft.network.chat.ClickEvent clickEvent)
      Set a click event on this message, defaults to null.
      Parameters:
      clickEvent - the click event instance.
      Returns:
      the new message builder object.
    • append

      public MessageUtils.MessageBuilder append(String key, Object... args)
      Starts a new builder object to append an additional component to the original one.
      Parameters:
      key - the translation key.
      args - the arguments for the translation component.
      Returns:
      the new message builder object.
    • append

      public MessageUtils.MessageBuilder append(net.minecraft.network.chat.Component component)
      Appends a new component to the
      Parameters:
      component - the component to send.
      Returns:
      the new message builder object.
    • create

      public net.minecraft.network.chat.MutableComponent create()
      Creates a text component that can be used as an argument to other components.
      Returns:
      the text component.
    • sendTo

      public void sendTo(net.minecraft.world.entity.player.Player... players)
      Send the message to one (or more) players.
      Parameters:
      players - the players to send the message to.
    • sendTo

      public void sendTo(Collection<net.minecraft.world.entity.player.Player> players)
      Send the message to a collection of players.
      Parameters:
      players - the players to send the message to.
    • sendToClose

      public void sendToClose(net.minecraft.core.BlockPos pos, int range, List<net.minecraft.world.entity.player.Player> players)
      Send the message to a collection of players close to a location.
      Parameters:
      players - the players to send the message to.
    • sendTo

      Send a message to a given colony, this method returns a class from which you will need to select which kind of members of the colony to send the message to.
      Parameters:
      colony - the reference to the colony.
      Returns:
      the message builder colony player selector.
    • sendTo

      public MessageUtils.MessageBuilderColonyPlayerSelector sendTo(IColony colony, boolean alwaysShowColony)
      Send a message to a given colony, this method returns a class from which you will need to select which kind of members of the colony to send the message to.
      Parameters:
      colony - the reference to the colony.
      alwaysShowColony - whether we always want to include the colony name in front of the message.
      Returns:
      the message builder colony player selector.