106 lines
1.9 KiB
Markdown
106 lines
1.9 KiB
Markdown
# IScriptServer.print
|
|
|
|
[← IScriptServer](index.md) · [← Master](../../wiki.md)
|
|
|
|
Parça 1/2 · [sonraki](print-2.md)
|
|
|
|
print(entity.getUniqueId() === uuid); // true
|
|
|
|
|
|
getAllPlayers
|
|
|
|
java.util.List<IScriptPlayer> getAllPlayers()
|
|
|
|
Get all players on the server.
|
|
|
|
var players = c.getServer().getAllPlayers();
|
|
|
|
for (var i in players)
|
|
{
|
|
// Surprise :)
|
|
players[i].setMotion(0, 0.5, 0);
|
|
}
|
|
|
|
|
|
getPlayer
|
|
|
|
IScriptPlayer getPlayer(java.lang.String username)
|
|
|
|
Get a player by their username.
|
|
|
|
var player = c.getServer().getPlayer("Notch");
|
|
|
|
|
|
|
|
if (player)
|
|
{
|
|
// I'm about to pull a prank on Notch... >:)
|
|
//
|
|
// Or give a nice present... :)
|
|
}
|
|
|
|
|
|
isOnline
|
|
|
|
default boolean isOnline(java.lang.String username)
|
|
|
|
Check if a player is online.
|
|
|
|
if (!c.getServer().isOnline("McHorse"))
|
|
{
|
|
c.send("McHorse is not online. :(")
|
|
}
|
|
|
|
|
|
getStates
|
|
|
|
IMappetStates getStates()
|
|
|
|
Get global (server) states.
|
|
|
|
var states = c.getServer().getStates();
|
|
|
|
if (states.getNumber("total_money_earned") > 1000000000)
|
|
{
|
|
// Give all players an achievement or something...
|
|
}
|
|
|
|
|
|
entityExists
|
|
|
|
boolean entityExists(java.lang.String uuid)
|
|
|
|
Check if an entity with given UUID exists.
|
|
|
|
if (c.getServer().entityExists("29a91933-86f2-4683-8a87-218084d8c927"))
|
|
{
|
|
// Do something...
|
|
}
|
|
|
|
|
|
Parameters:
|
|
uuid - The UUID of the entity to check for existence.
|
|
|
|
Returns:
|
|
true if an entity with the specified UUID exists, false otherwise.
|
|
|
|
executeScript
|
|
|
|
void executeScript(java.lang.String scriptName)
|
|
|
|
Execute a script with a given script name and the default function "main".
|
|
|
|
c.getServer().executeScript("example_script.js");
|
|
|
|
|
|
Parameters:
|
|
scriptName - The name of the script to execute.
|
|
|
|
executeScript
|
|
|
|
void executeScript(java.lang.String scriptName,
|
|
java.lang.String function)
|
|
|
|
Execute a script with a given script name and a specified function.
|
|
|