9.2. Built-in Namespaces

Quick reference for built-in namespace functions and types. For creating and using namespaces, see Namespaces.

9.2.1. entity

Entity type utilities.

Type

Description

EntityType

Represents a Minecraft entity type (e.g., ZOMBIE, CREEPER).

Variable

Type

Value

acaciaBoat

EntityType

Represents an acacia boat entity.

acaciaChestBoat

EntityType

Represents an acacia chest boat entity.

EntityType

[all other Minecraft entity types]

zombieVillager

EntityType

Represents a zombie villager entity.

zombifiedPiglin

EntityType

Represents a zombified piglin entity.

The entity namespace has no functions.

9.2.2. format

Text formatting utilities.

Type

Description

TextFormat

Represents a text color or formatting code.

Function

Return Type

Description

formatDate(Long millis, String format)

String

Format a Unix timestamp (milliseconds) using the given format string.

getChatColorFromChat(String char)

TextFormat

Get a TextFormat from a color code character (e.g., "a" for green).

stripColor(String input)

String

Remove all color codes from a string.

Variable

Type

Value

black

TextFormat

“§0” (black color code)

darkBlue

TextFormat

“§1” (dark blue color code)

TextFormat

[all other formatting codes]

underline

TextFormat

“§n” (underline format code)

reset

TextFormat

“§r” (reset format code)

9.2.3. list

List utility functions.

Function

Return Type

Description

range(Int start, Int end)

Int[]

Generate a list of consecutive integers from start (inclusive) to end (exclusive).

The list namespace has no types or variables.

9.2.4. material

Material/block type utilities.

Type

Description

Material

Represents a Minecraft material (item).

Variable

Type

Value

acaciaBoat

Material

Represents an acacia boat item.

acaciaButton

Material

Represents an acacia button item.

Material

[all other Minecraft items and blocks]

zombieWallHead

Material

Represents a zombie wall head item.

zombifiedPiglinSpawnEgg

Material

Represents a zombified piglin spawn egg item.

The material namespace has no functions.

9.2.5. math

Common mathematical operations.

Function

Return Type

Description

abs(Double value)

Double

Absolute value (value if positive, -value if negative).

sqrt(Double value)

Double

Positive square root.

pow(Double base, Double exponent)

Double

Base raised to the power of exponent.

floor(Double x)

Int

Round down to nearest integer (towards negative infinity).

ceil(Double x)

Int

Round up to nearest integer (towards positive infinity).

sin(Double x)

Double

Sine of x (degrees).

cos(Double x)

Double

Cosine of x (degrees).

tan(Double x)

Double

Tangent of x (degrees).

arcsin(Double x)

Double

Arcsine of x (returns degrees).

arccos(Double x)

Double

Arccosine of x (returns degrees).

arctan(Double x)

Double

Arctangent of x (returns degrees).

radsin(Double x)

Double

Sine of x (radians).

radcos(Double x)

Double

Cosine of x (radians).

radtan(Double x)

Double

Tangent of x (radians).

radarcsin(Double x)

Double

Arcsine of x (returns radians).

radarccos(Double x)

Double

Arccosine of x (returns radians).

radarctan(Double x)

Double

Arctangent of x (returns radians).

rad(Double x)

Double

Convert degrees to radians.

deg(Double x)

Double

Convert radians to degrees.

random(Double min, Double max)

Double

Random double between min and max.

randomDouble()

Double

Random double between 0.0 and 1.0.

randomFloat()

Float

Random float between 0.0 and 1.0.

randomInt()

Int

Random integer (full Int range).

randomLong()

Long

Random long (full Long range).

The math namespace has no types or variables. For special cases (NaN, infinity, etc.), see Java Math documentation.

9.2.6. minr

Minr-specific map and challenge utilities.

Type

Description

Challenge

Represents a Minr challenge.

Map

Represents a Minr map.

The minr namespace has no functions or variables.

9.2.7. scoreboard

Minecraft scoreboard manipulation.

Function

Return Type

Description

addObjective(String name, String type, String displayName)

Void

Create a new scoreboard objective.

removeObjective(String objective)

Void

Remove a scoreboard objective.

objectiveExists(String objective)

Boolean

Check whether an objective exists.

getScore(String player, String objective)

Int

Get a player’s score for a given objective.

setScore(String player, String objective, Int score)

Void

Set a player’s score for a given objective.

setObjectiveDisplaySlot(String objective, String slot)

Void

Set which slot displays the objective.

getObjectiveDisplaySlot(String objective)

String

Get the display slot for an objective.

getObjectiveInDisplaySlot(String slot)

String

Get which objective is in a display slot.

clearDisplaySlot(String slot)

Void

Clear a display slot.

resetObjectiveDisplaySlot(String objective)

Void

Reset an objective’s display slot.

The scoreboard namespace has no types or variables.

9.2.8. statistic

Minecraft statistic utilities.

Type

Description

Statistic

Represents a Minecraft statistic (e.g., JUMP, WALK_ONE_CM). No constructors.

Variable

Type

Value

animalsBred

Statistic

Represents the ANIMALS_BRED statistic.

armorCleaned

Statistic

Represents the ARMOR_CLEANED statistic.

Statistic

[all other Minecraft statistics]

walkOneCm

Statistic

Represents the WALK_ONE_CM statistic.

walkUnderWaterOneCm

Statistic

Represents the WALK_UNDER_WATER_ONE_CM statistic.

The statistic namespace has no functions.

9.2.9. system

Miscellaneous system functions.

Function

Return Type

Description

currentTimeMillis()

Long

Returns the current time in milliseconds since Unix epoch (January 1, 1970).

getTPS()

Double[]

Returns a list of 3 values: average server TPS over the last 1, 5, and 15 minutes.

The system namespace has no types or variables.

9.2.10. text

Rich text (JSON chat component) utilities.

Type

Description

TextComponent

A single rich text component with formatting, click events, etc.

ComponentBuilder

Builder pattern for constructing TextComponent arrays.

Function

Return Type

Description

deserialise(String json)

TextComponent[]

Parse JSON text into components.

serialise(TextComponent[] components)

String

Convert components to JSON.

fromLegacyText(String text, TextFormat defaultColor)

TextComponent[]

Convert legacy color-coded text to components.

toLegacyText(TextComponent[] components)

String

Convert components to legacy color-coded text.

toPlainText(TextComponent[] components)

String

Strip formatting, return plain text.

escapeJSON(String json)

String

Escape special characters in JSON.

The text namespace has no variables.

9.2.11. timer

Timer management functions for maps and challenges.

Type

Description

Timer

Represents a timer instance for tracking player progress.

Function

Return Type

Description

getMapTimer(Player player, String mapcode)

Timer

Get a player’s timer for a map.

getChallengeTimer(Player player, String tag)

Timer

Get a player’s timer for a challenge.

getCustomTimer(Player player, String tag)

Timer

Get a player’s custom timer by tag.

getSpecialTimer(Player player, String tag)

Timer

Get a player’s special timer.

removeCustomTimer(Player player, String tag)

Void

Remove a custom timer.

formatTime(Long time)

String

Format a time value as a human-readable string.

The timer namespace has no variables.

Warning

Never store Timer instances in namespace variables, as they will break silently. Always use timer::getCustomTimer(...) to retrieve a fresh reference each time.

9.2.12. util

Utility functions.

Function

Return Type

Description

executeAndQueryResult(String cmd)

Boolean

Run an /execute command as the console and return its result value.

executeAndQuerySuccess(String cmd)

Int

Run an /execute command as the console and return whether or not it succeeded.

randomUUID()

String

Generate a random UUID string.

The util namespace has no types or variables.