Tags
Setting a tag
Tags give you the ability to change a prefix, suffix and the colour of the player's name. You can see the tag in the tab list and above their head. To use this, you must have an instance of the TagHandler class initialised. Just create a variable and create a new instance.
Now, create a new instance of the TagData class. This will include the prefix, suffix and the colour. You do not need to use this class, you may use the method already built in. If you do not wish to change the prefix, suffix or colour, but only one or two of them, just make them null. This will ignore the input for this parameter.
A new instance of the TagData class may look like this:
TagData data = new TagData(player, "&4Owner", "&c", null);To apply the data, the TagHandler class has a method for that. This method is called TagHandler#setTag. You may also just use the setPrefix, setColour and setSuffix methods.
NOTE: There can only be one TagHandler class instance as it stores the tags in a map thus conflicting with clearing and setting new data. I advice you to make an instance in your main class and only use that instance.
This is an example of how to use tags:
TagHandler tagHandler = ...; // Your way to getting the tag handler.
TagData data = new TagData(player, null, "&a", null);
tagHandler.setTag(data);
// or just do
tagHandler.setColour("&a");When you set a new tag, it will not conflict with the other data, for example if you create one with a suffix and one without, both will be shown.
Clearing a tag
To clear a tag is very simple, all you have to do is use the TagHandler#clear method. Just like this:
TagHandler tagHandler = ...; // Your way to getting the tag handler.
tagHandler.clear(player);Last updated