2.8.0
Added the ability for expansions to provide relational placeholders. These types of placeholders can show information specific to the relation between 2 players. A good example would be the relation between 2 factions:
PlaceholderAPI does not automatically parse relational placeholders on its own when normal placeholders are parsed!. Plugins which would want to utilize these placeholders will need to update and call the new method to parse relational placeholders:
Code (Java):
PlaceholderAPI.
setRelationalPlaceholders
(Player one, Player two,
String message
)
;
End users will need to specify the relational placeholders with a specific format:
Code (Text):
%rel_<placeholder>%
Note, only placeholders created specifically for relation based values will work. %rel_player_name% wouldn't work as that is a normal placeholder but %rel_factions_relation_color% would work as it is a valid relational placeholder.
For developers to add this functionality in expansions. Here is a brief example of an expansion suited for relational placeholders:
Code (Java):
public
class RelationalExpansion
extends PlaceholderExpansion
implements Relational
{
@Override
public
boolean canRegister
(
)
{
return
true
;
}
@Override
public
String getAuthor
(
)
{
return
"clip"
;
}
@Override
public
String getIdentifier
(
)
{
return
"player"
;
}
@Override
public
String getPlugin
(
)
{
return
null
;
}
@Override
public
String getVersion
(
)
{
return
"1.0.0"
;
}
@Override
public
String onPlaceholderRequest
(Player p,
String s
)
{
// %player_name%
if
(s.
equals
(
"name"
)
)
{
return p.
getName
(
)
;
}
return
null
;
}
@Override
public
String onPlaceholderRequest
(Player one, Player two,
String identifier
)
{
// %rel_player_distance%
if
(identifier.
equals
(
"distance"
)
)
{
return
String.
valueOf
(one.
getLocation
(
).
distance
(two.
getLocation
(
)
)
)
;
}
return
null
;
}
}
Placeholder expansions will now be automatically loaded when /papi ecloud download <expansion> is executed. No more need to use /papi reload afterwards.
Added a config option to automatically download and register missing expansions when a placeholder is used that is not currently registered. if the expansion exists on the cloud.
This will be set to true by default.
Added 1.12 to the NMSVersion enum.