Values
Read something from the game, or turn one value into another.
join text [text]
Joins several pieces into one text, in order. Press + to add another piece. Numbers and other values are turned into text first.
| Slot | Takes | What it is for |
|---|---|---|
| 1 | text | A piece of the text. |
Gives back: text
Script: "text" + value
[Player] has played before
Checks if this player has played on this server before.
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Player | The Player to act on. |
Gives back: true/false. True if the player has played before, otherwise false
Script: player.hasPlayedBefore()
name of [Player]
{@inheritDoc}
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Player | The Player to act on. |
Gives back: text
Script: player.getName()
location of [Player]
Gets the entity's current position
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Player | The Player to act on. |
Gives back: Location. a new copy of Location containing the position of this entity
Script: player.getLocation()
world of [Player]
Gets the current world this entity resides in
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Player | The Player to act on. |
Gives back: World. World
Script: player.getWorld()
health of [Player]
Gets the entity's health from 0 to getMaxHealth(), where 0 is dead.
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Player | The Player to act on. |
Gives back: number. Health represented from 0 to max
Script: player.getHealth()
food level of [Player]
Gets the players current food level
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Player | The Player to act on. |
Gives back: number. Food level
Script: player.getFoodLevel()
[Player] is sneaking
Returns if the player is in sneak mode
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Player | The Player to act on. |
Gives back: true/false. true if player is in sneak mode
Script: player.isSneaking()
game mode of [Player]
Gets this human's current GameMode
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Player | The Player to act on. |
Gives back: GameMode. Current game mode
Script: player.getGameMode()
[Player] has permission [text]
Gets the value of the specified permission, if set. If a permission override is not set on this object, the default value of the permission will be returned.
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Player | The Player to act on. |
| 2 | text | Name of the permission |
Gives back: true/false. Value of the permission
Script: player.hasPermission(text)
[Location] offset by x:[number] y:[number] z:[number]
Moves a location by the given amounts along x, y and z, and gives it back. It changes the location it is given as well, so use it on a fresh location, such as location of a player or of a block, rather than on one you want to keep as it is.
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Location | The location to move. |
| 2 | number | How far to move along x (east is positive). |
| 3 | number | How far to move along y (up is positive). |
| 4 | number | How far to move along z (south is positive). |
Gives back: Location. the same location
Script: location.add(number, number, number)
distance from [Location] to [Location]
Get the distance between this location and another. The value of this method is not cached and uses a costly square-root function, so do not repeatedly call this method to get the location's magnitude. NaN will be returned if the inner result of the sqrt() function overflows, which will be caused if the distance is too long.
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Location | The Location to act on. |
| 2 | Location | The other location |
Gives back: number. the distance
Script: location.distance(location)
x of [Location]
Gets the x-coordinate of this location
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Location | The Location to act on. |
Gives back: number. x-coordinate
Script: location.getX()
y of [Location]
Gets the y-coordinate of this location
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Location | The Location to act on. |
Gives back: number. y-coordinate
Script: location.getY()
z of [Location]
Gets the z-coordinate of this location
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Location | The Location to act on. |
Gives back: number. z-coordinate
Script: location.getZ()
block at [Location]
Gets the block at the represented location
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Location | The Location to act on. |
Gives back: Block. Block at the represented location
Script: location.getBlock()
material of [Block]
Gets the type of this block
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Block | The Block to act on. |
Gives back: Material. block type
Script: block.getType()
location of [Block]
Gets the Location of the block
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Block | The Block to act on. |
Gives back: Location. Location of block
Script: block.getLocation()
world of [Block]
Gets the world which contains this Block
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Block | The Block to act on. |
Gives back: World. World containing this block
Script: block.getWorld()
text of [any value]
Turns any value into text, so it can be joined with other text or put in a message. Numbers become their digits; a location, a block or a player becomes a readable description of it.
| Slot | Takes | What it is for |
|---|---|---|
| 1 | any value | The value to turn into text. |
Gives back: text
Script: value.toString()
plain text of [Component]
Strips the colours and formatting off a chat message and leaves the bare text. Useful on the message an event hands you -- comparing formatted chat against plain text otherwise fails for reasons that are invisible on screen.
| Slot | Takes | What it is for |
|---|---|---|
| 1 | Component | The chat message to flatten, such as the one a chat or join event provides. |
Gives back: text
Script: component.plainText()