Name Variables
Not working with MMOItems because of Kiori Adventure Color Corruption
Not working with MMOItems because of Kiori Adventure Color Corruption
As of GooP 1.6.7, one can use the following syntax when naming items within the plugin, or adding lore. These are the advantages:
Can make players rename items in anvil and only target a portion of the name, keeping the rest unchanged.
Allows for PlaceholderAPI placeholders in name and lore.
Allows players to rewrite lore in an anvil.
Allows to rename items while keeping their upgrade level.
Simple text, something you write usually. Nothing special.
A variable encoded in the name of your item. To specify it, write @[variable]=[text]@.
You can compound these into a huge name, say [text] @[variable]=[text]@ [text]:
Rhomeus, Greatsword of @user=Jack@
@name=Caladbolg@, Arc of Rainbows
@prefix=✬@ Starlight, @description=The Paladin's Promise@ @prefix@
Notice that more than one variable is permitted, even if its the same one twice. Only the text in bold will be visible.
Placeholders must be specified within a variable. This allows to completely omit a whole chunk if the placeholder is numeric and outside a threshold. Write @[variable]=+%item_level%@, for example, this:
Will parse as the numeric value of the item's level
Will not display at all if the level is less than a value specified in the config (suppose, just remove it altogether if level is zero).
This includes the preceding plus.
Will update when picked up, when the player logs in, when the player renames the item in an anvil, or when the rewrite variable command is called (see below).
Example:
@prefix=✬@ Starlight, @name=The Paladin's Promise@ @level=+%item_level%@ @prefix@
Will have the unique mechanic of displaying its item level between the prefixes, and when the player renames it in an anvil, it only changes the part where it says "The Paladin's Promise". Which leads us to the special variables.
name - The most notably special variable. This part of the text will be targetted when players rename in an anvil. If it is missing, players will be able to overwrite the name completely. In fact, if this variable is not specified, the longest portion of variableless text is taken to be its value.
PAPI - This is a placeholder variable: when you try to update it, it actually means update all PAPI placeholders in the name rather than updating the text of this variable.
other - To target any variables not touched anywhere else. This will keep their exact order. Will also include variableless text. You may use the variant:
otherx - Will count the times the variables appear originally vs the times you are adding them and only write out the difference.
fullname - Using this will stand for the whole name already in there, beware of using it several times in a row, if you add text it will add it each time.
If the name already has a variable in it, say, prefix, you may rename into something like this:
@prefix@ @prefix@ @prefix@ A name with only prefixes @prefix@ @prefix@ @prefix@
Result: ✬ ✬ ✬ A name with only prefixes ✬ ✬ ✬
This will use the previous value of @prefix@, if there is any. If there is none, they will be ignored and deleted. If there were more than one prefix variables in the original name, the value of the first one will be used.
Depending on the colored-text-library of the plugins you use, this feature might not work at all because it relies heavily on color codes encoding, which some libraries like Kiori love to delete; because they think its unecessary just because it is invisible.