Main Menu


Started by KingofGamesYami, Aug 13, 2018, 01:21 AM

Previous topic - Next topic


Reposted from here

The objective of CommandsPlus is to extract data from the results of running various commands. For example, teleporting an armor stand to a player gives us the player's coordinates and which way he's facing.
pastebin get eZRj0fAD commandsPlus.


getPlayerPosition( playerName )Retrieves the position (x, y, z) of the specified player. Specifying something other than an online player's name will result in an error.

getPlayerRotation( playerName )Retrieves the rotation (about the vertical axis, about the horizantal axis) of the specified player. Again, specifying something other than an online player's name will result in an error.

getNearbyPlayers( nLimit )Retrieves a list of players within nLimit blocks of the computer. If nLimit is not specified, no radius will be used.

getGameruleValue( gamerule )Retrieves the value of a gamerule (eg "commandBlockOutput")

getDaysPassed()Retrieves the number of (in game) days passed since the world's creation.

getGametime()Retrieves the current gametime.

getDaytime()Retrieves the (in game) time of day.

getWorldborder()Retrieves the current radius of the world's border.

getFormattedBlockInfos( x1, y1, z1, x2, y2, z2 )Retrieves information using commands.getBlockInfos, but formats it into a table indexed by coordinates.

getObservedBlock( playerName )Retrieves the block currently being observed by playerName. Credit to moomoomoo3O9 for the original function
Note: this is sometimes inaccurate due to non-full blocks or entities.

getForgeTPS()Retrieves information about ticks-per-second. The table is formatted like so:
[ dimension ] = { time = MEAN_TIME, tps = MEAN_TPS }

listScoreboardTeams()Retrieves a table of teams with the number of players on each team, in the format t[ name ] = number_of_players

listScoreboardObjectives()Retrieves a table of objectives and their display name and type, in the format t[ name ] = {displayName = "Hello", type = "World"}

listScoreboardPlayers()Retrieves a table of players being tracked by scoreboard.

listScoreboardTeamPlayers( teamName )Retrieves a list of players on team teamName

If there are any commands you'd like me to add, please comment below ;)
1.1 - Added getObservedBlock and getFormattedBlockInfos, added second argument to getPlayerPosition, changed behavior of getNearbyPlayers when no limit specified.
1.2 - Added getForgeTPS()
1.25 - Removed second argument from getPlayerPosition, added caching. The data is only cached for 1 tick, so that if you use getObservedBlock and getPlayerPosition or getPlayerRotation, it won't teleport things more than it needs to.
1.3 - Added listScoreboardTeams, listScoreboardObjectives, listScoreboardPlayers, and listScoreboardTeamPlayers

PS: Apologies for wall of text, supposedly spoilers will be available in the future (@Yemmel)
I'm a ComputerCraft veteran with over 3k posts on the old ComputerCraft Forum.  I'm mostly inactive in CC having moved on to bigger, more interesting projects but still contribute to the community.