Package com.minecolonies.api.util
Class MessageUtils.MessageBuilder
java.lang.Object
com.minecolonies.api.util.MessageUtils.MessageBuilder
- Enclosing class:
MessageUtils
Starting class for the message building. Contains primary logic for sending the messages.
-
Method Summary
Modifier and TypeMethodDescriptionStarts a new builder object to append an additional component to the original one.append(net.minecraft.network.chat.Component component) Appends a new component to thenet.minecraft.network.chat.MutableComponentcreate()Creates a text component that can be used as an argument to other components.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.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.voidsendTo(Collection<net.minecraft.world.entity.player.Player> players) Send the message to a collection of players.voidsendTo(net.minecraft.world.entity.player.Player... players) Send the message to one (or more) players.voidsendToClose(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.withClickEvent(@NotNull net.minecraft.network.chat.ClickEvent clickEvent) Set a click event on this message, defaults to null.@NotNull MessageUtils.MessageBuilderwithPriority(MessageUtils.MessagePriority priority) Set the priority of this message, defaults toMessageUtils.MessagePriority.NORMAL.
-
Method Details
-
withPriority
@NotNull public @NotNull MessageUtils.MessageBuilder withPriority(MessageUtils.MessagePriority priority) Set the priority of this message, defaults toMessageUtils.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
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
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
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.
-