feat: Implement authme_in_auth_server and authme_player_in_auth_server placeholders
This commit is contained in:
parent
a41d22d762
commit
6365866e59
@ -13,14 +13,26 @@ final class AuthmePlaceholders {
|
||||
static Expansion getExpansion(AuthMeVelocityPlugin plugin){
|
||||
return Expansion.builder("authme")
|
||||
.filter(Player.class)
|
||||
// Logged Placeholders
|
||||
.audiencePlaceholder("is_logged", (aud, queue, ctx) ->
|
||||
Tag.selfClosingInserting(plugin.getAPI().isLogged((Player)aud) ? TRUE_COMPONENT : FALSE_COMPONENT))
|
||||
.globalPlaceholder("is_player_logged", (queue, ctx) -> {
|
||||
String playerName = queue.popOr(() -> "you need to provide a player").value();
|
||||
return Tag.selfClosingInserting(
|
||||
plugin.getProxy().getPlayer(playerName).map(pl -> plugin.getAPI().isLogged(pl)).isPresent()
|
||||
? TRUE_COMPONENT
|
||||
: FALSE_COMPONENT
|
||||
plugin.getProxy().getPlayer(playerName)
|
||||
.map(plugin.getAPI()::isLogged)
|
||||
.orElse(false) ? TRUE_COMPONENT : FALSE_COMPONENT
|
||||
);
|
||||
})
|
||||
// In Auth Server placeholders
|
||||
.audiencePlaceholder("in_auth_server", (aud, queue, ctx) ->
|
||||
Tag.selfClosingInserting(plugin.getAPI().isInAuthServer((Player)aud) ? TRUE_COMPONENT : FALSE_COMPONENT))
|
||||
.globalPlaceholder("player_in_auth_server", (queue, ctx) -> {
|
||||
String playerName = queue.popOr(() -> "you need to provide a player").value();
|
||||
return Tag.selfClosingInserting(
|
||||
plugin.getProxy().getPlayer(playerName)
|
||||
.map(plugin.getAPI()::isInAuthServer)
|
||||
.orElse(false) ? TRUE_COMPONENT : FALSE_COMPONENT
|
||||
);
|
||||
})
|
||||
.build();
|
||||
|
Loading…
x
Reference in New Issue
Block a user