#how to make a Java script RawText in a placeholder
1 messages · Page 1 of 1 (latest)
`var perm = PlaceholderAPI.static.setPlaceholders(BukkitPlayer, "%player_has_permission_premium%");
function premium() {
if (perm == "yes") {
return "&fꐘ";
}
if (perm == "no") {
return "";
}
}
premium();`
you can easily do this with changeoutput instead
how?
%changeoutput_equals_input:{player_has_permission_premium}_matcher:yes_ifmatch:&fꐘ_else:%
-papi changeoutput
oh ya the botdon't work
@brazen grove
-papi changeoutput
hmmm
type /papi ecloud download changeoutput
then /papi reload
but I had another question
this would turn %player_has_permission_premium% into the placeholder value before the script even ran
if you have a placeholder in your javascript, it gets parsed before the script runs
PlaceholderAPI.static.setPlaceholders(BukkitPlayer, <string>); is mainly used for when you need to piece together a placeholder
such as: PlaceholderAPI.static.setPlaceholders(BukkitPlayer, "%player_has_permission_" + perm + "%");
note: your script should still work as you've written it
It turns out you can’t add rawtext to a placeholder? I need that when a player in the chat hovers over “ꐘ”, a mini-message “Premium subscribe” will be displayed for him
ohhh
ya, you can't do that
placeholders are just strings
it would then be up to your chat plugin to add any info like hovering/clicking events
Is it possible to somehow improve my script, just if the player has an op, but no placeholder, it still displays “ꐘ” instead of “”
%player_is_op% placeholder exists
you can also implement it into changeoutput if you wanted, using the utils expansion
it'll still be faster than js
how?
%utils_parse_changeoutput_equals_input:{player_has_op}_matcher:yes_ifmatch:&fꐘ_else:{changeoutput_equals_input:{player_has_permission_premium}_matcher:yes_ifmatch:&fꐘ_else:}%
you'll need the utils expansion ofc
/papi ecloud download utils
/papi reload
My entire server died because of one placeholder