-
Notifications
You must be signed in to change notification settings - Fork 1
Home
This wiki contains all information about TextDisplayer, including MessageParser documentation and how to create your own display messages. TextDisplayer is fairly straight forward and doesn't have to many confusing features which is how it is intended to be
Information regarding MessageParsers
What are MessageParsers? They are specific messages that get replaced with other things. Such as how {USERNAME}
will be replaced with the player's username.
Developers can easily add their own MessageParser, a tutorial is listed below. Generally custom MessageParsers will be called after all the custom ones.
Below is a list of all the default MessageParser placeholders - Source
{USERNAME} - The player's username
{HEALTH} - The players health (in half hearts)
{HEARTS} - The player's health divided by two (stimulating hearts)
{HUNGER} - The players hunger level
{X} - X location of the player
{Y} - Y location of the player
{Z} - Z location of the player
{SERVERNAME} - The current connected servers name (in your multiplayer tab)
{SERVERPING} - The ping to the connected server
{SERVERIP} - The current connected servers ip address
{SERVERPOPULATION} - The amount of players that appear in the server ping list (eg: 1/20)
{PLAYERCOUNT} - Amount of players in the world (that aren't invisible)
Some CPS (Clicks-per-second) related placeholders - Source
{CPS} - Left mouse button CPS
{LEFT_CPS} - Left mouse button CPS
{CPS_LEFT} - Left mouse button CPS
{RCPS} - Right mouse button CPS
{RIGHT_CPS} - Right mouse button CPS
{CPS_RIGHT} - Right mouse button CPS
PVP-Related placeholders (These are still in beta and may not work) - Source
{LASTDAMAGED} - Who you last hit/attacked
Which direction the player is facing - Source
{FACING_LARGE} - Displays directions as North, North East, South, South West, etc...
{FACING_SMALL} - Displays directions as N, NE, S, SW, etc...
The rest are inventory based
{HAND_NAME} - Name of the item in your hand
{HAND_TOTALAMOUNT} - Total amount of items in your inventory that match the item in your hand
{HAND_AMOUNT} - Stack size of the item in your hand
{HAND_DURA} - Current durability of the item in your hand
{HAND_MAX} - The max durability of the item in your hand
{ARROWCOUNT} - Amount of arrows currently in your inventory
{ARMOR_HEAD_NAME} - Displayname of your helmet
{ARMOR_HEAD_DURA} - Current durability of your helmet
{ARMOR_HEAD_MAX} - Max durability of your helmet
{ARMOR_CHEST_NAME} - Displayname of your chestplate
{ARMOR_CHEST_DURA} - Current durability of your chestplate
{ARMOR_CHEST_MAX} - Max durability of your chestplate
{ARMOR_LEGS_NAME} - Displayname of your leggings
{ARMOR_LEGS_DURA} - Current durability of your leggings
{ARMOR_LEGS_MAX} - Max durability of your leggings
{ARMOR_BOOTS_NAME} - Displayname of your boots
{ARMOR_BOOTS_DURA} - Current durability of your boots
{ARMOR_BOOTS_MAX} - Max durability of your boots
(As of v2.0) Once a class that extends MessageParser is made, it must be registered by calling the MessageParser.addParser(MessageParser) method
The following example will allow you to create a MessageParser to replace {MESSAGE}
in TextDisplayer
public class CustomParser extends MessageParser {
@Override
public String getName() {
return "CustomParser";
}
@Override
public ParsedMessage parse(ParsedMessage input) {
return input.replace("MESSAGE", "Hey you found my message! :D");
}
}
Note ParsedMessage requires that the key (in this case "MESSAGE") and replacement ("Hey you found my message!") ARE NOT NULL OR EMPTY. This will most likely change in the future however as of v2.0 this is how it acts.
Note 2
In your #parse
method, do not return a new ParsedMessage instance, or else your MessageParser will not work. Review here
TextDisplayer documentation was last updated for version 2.0.
Select a page above for more documentation