Skip to content

Different placeholder pattern #36

@Andre601

Description

@Andre601

There should be a different, more distinct placeholder pattern to use in PlaceholderAPI.

The %placeholder% format is just flawed, may clash with plugins that already use such a format for internal placeholders, looks ugly IMO and also is harder to use when you would like to allow nested placeholders.

One suggestion that was given is to use ${placeholder_value}, as it is commonly used on places like terminal/command line stuff.
It would also allow a (hopefully) more easy Pattern to use for nested placeholder solving.

Another thing I feel like would be good is to have the pattern have space-separated options, rather than underscore one.
So instead of ${player_name} would it be ${player name}
This could have benefits by f.e. having a onRequest method that has a String[] args option provided.
It would simplify splitting up values, as you now would have them provided as is without the need to do splitting first.

Assume the following:

public String onRequest(OfflinePlayer player, String[] args) {
    if (args.length == 0)
        return null;
    
    switch(args[0].toLowerCase(Locale.ROOT)) {
        case "name":
            return player.getName();
        
        case "uuid":
            return player.getUniqueId().toString();
        
        // ...
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions