How can I get a random player's name in ScriptAPI?
-
Just like what AtAllProvider does
I probably made a thread about this on my older account which had the answer on it
@CzechHekarray of NetworkPlayerInfos
playerInfos = Java.from(mc.getNetHandler().getPlayerInfoMap())array of names
playerNames = playerInfos.map(function (info) info.getGameProfile().getName())getting a random name
playerInfos.random().getGameProfile().getName()
or
playerNames.random()if you don't use Core then just skid the random() function thx
https://github.com/CzechHek/Core/blob/15d49a96a9423bd03dc2981392fae61b433122c8/Core.lib#L359 -
array of NetworkPlayerInfos
playerInfos = Java.from(mc.getNetHandler().getPlayerInfoMap())array of names
playerNames = playerInfos.map(function (info) info.getGameProfile().getName())getting a random name
playerInfos.random().getGameProfile().getName()
or
playerNames.random()if you don't use Core then just skid the random() function thx
https://github.com/CzechHek/Core/blob/15d49a96a9423bd03dc2981392fae61b433122c8/Core.lib#L359 -
A Ali00035 has marked this topic as solved on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login