#how to make a Java script RawText in a placeholder

1 messages · Page 1 of 1 (latest)

sour jewel
#

how to make a Java script RawText in a placeholder

#

`var perm = PlaceholderAPI.static.setPlaceholders(BukkitPlayer, "%player_has_permission_premium%");

function premium() {
if (perm == "yes") {
return "&fꐘ";
}
if (perm == "no") {
return "";
}
}

premium();`

eager onyx
#

you can easily do this with changeoutput instead

eager onyx
#

%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

sour jewel
eager onyx
#

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

sour jewel
#

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

eager onyx
#

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

sour jewel
#

Is it possible to somehow improve my script, just if the player has an op, but no placeholder, it still displays “ꐘ” instead of “”

eager onyx
#

%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

sour jewel
#

how?

eager onyx
#

%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

eager onyx
#

O.o

#

maybe you got a corrupted jar

#

try manually downloading it from the ecloud

sour jewel
#

My entire server died because of one placeholder

eager onyx
sour jewel
#

it shows emoji if:
player OP, the player has/does not have permission "premium"

eager onyx
#

maybe use the luckperms placeholder not the player one

#

%luckperms_has_permission_<permission>%