Solved 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
@CzechHek -
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 -
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 -
@czechhek i might use core and ty
-
Ali00035