Closed joex92 closed 3 years ago
Hello. So this is a cool placeholder but could you please explain why this placeholder should be used over the PlayerList expansion? We try to only add placeholders that don't exist in other expansions and in my opinion the PlayerList does this job and a lot more.
P.S.: I am aware that some existing ones exist already but those were made and posted before the expansions were.
oh, the only one I knew was ListPlayer and when I tried to install it, it wasn't being "supported":
[Sun, 6. Jun 2021 17:50:06 UTC WARN] listplayers is attempting to register placeholders via a PlaceholderHook class which is no longer supported!
So I thought that was the only one with what I wanted... I'm going to try PlayerList then, for some reason I didn't see it...
also, I want to use this placeholder as an Alert in DiscordSRV, but for some reason my script works in console, works in Minecraft chat, but it doesn't work sending it through an Alert... it's weird... hopefully PlayerList will work...
Now I remember why I didn't use PlayerList
Well that's strange bcz for me it works:
U could try to just manually download it.
Download it from here: https://api.extendedclip.com/expansions/playerlist/
and put it in plugins/PlaceholderAPI/expansions
and then do /papi reload
thanks! it worked! the host I'm using is constantly sending /list
to the console, so I wanted to take advantage of that to get the list of players and send it to the console chat in Discord, here's the alert if anyone looks for it:
- Trigger: ServerCommandEvent
Channel: console
Conditions:
- '#event.getCommand().equals("list")'
Embed:
Color: "#00ff00"
Author:
Name: 'Online players: ${#server.onlinePlayers.size()}'
Description: "%playerlist_online,normal,yes,list%"
this is the output:
but I tested out, and the list of players is sent as 1 string separated by ",
"... and I wanted to separate them by "\n
" so it shows one above the other in discord...
Well you can always use the javascript for that but yeah the reason we won't put this on the wiki is bcz there's already a better alternative I guess
🤔 hmm... you are right! I'm going to use javascript to replace ",
" with "\n
"...
anyways, thanks!
%javascript_onlinePlayerList_<delimiter>%
(Default delimiter: ",
")%javascript_onlinePlayerList_|%
- Outputs: "player1|player2|player3"Javascript Code
onlinePlayerList.js
Add to
javascript_placeholders.yml