Simple Prefix Metadata

Simple Prefix Logo

Main | Configuration | Metadata | Source

Metadata

As of Simple Prefix v2.0, prefixes and suffixes are saved to the player using metadata.

If you want to access a prefix or suffix from a player, it is super easy to do, all you need is this code:

1
2
3
4
5
6
public String getPrefixSuffix(Player player, String type){    
    if(player.hasMetadata(type)){
        return player.getMetadata(type).get(0).asString();
    }
    return "";
}

Then to get a prefix or suffix, just call that function:

1
2
String prefix = getPrefixSuffix(player, "prefix");
String suffix = getPrefixSuffix(player, "suffix");