👥Target patterns
Last updated
Last updated
Target patterns define who will receive an specific message and where it must be sent, for example, let's say you want one text to be sent if the receiver is a player and another different text to be sent if the receiver is the console, well, you can do that with MCUtils without defining multiple messages, allowing administrators to choose exactly how they want their messages to be sent.
Messages can be sent to target's ActionBar, obviously this will only occur if the target is a player, if not, the message won't be sent.
Pattern is: <ab:Text to send/ab>
, and of course, you can use all color patterns in the text if you want to.
Let's see a an example, imagine we want to send both an ActionBar message and a regular chat message to a player only using one string, well, that's easy:
<ab:&aThis goes to the ActionBar/ab>&aThis goes to the chat
In-game, that would look like this
What if we want the previous chat message to be sent only to the console and not players? Well, that's easy too, and again, color patterns can be used inside of this pattern without any issue if you want to.
Let's take the ActionBar example, making it so players only receive the ActionBar message and the console receives the chat message.
<ab:&aThis goes to the ActionBar/ab><c:&aThis goes to the console/c>
We already know how that looks in-game, but let's see the console
A message without any target pattern would be sent to both console and player targets, but what if we want one message to be sent only to players and another message to be sent only to the console?
The pattern to use here is as you might have already expected <p:Text to send/p>
, yet again, just to be clear, you can use all color patterns inside of this pattern as well as action patterns.
Let's take a look at this example:
<p:&aThis goes only to players/p><c:&aThis goes only to the console/c>
So in-game, that looks like this