Skip to content

Commands

Danae Dekker edited this page Aug 12, 2024 · 15 revisions

At its core, GregoRail uses a range of commands to manage codes for minecarts and change the world around it based on those codes. The commands use a custom format for defining locations and querying codes, which are explained below the command overview.

Commands

The available commands are divided into several commands and subcommands, which are explained in the following sections:

  • /gregorail for administration commands.
  • /gtag for managing tags of minecart codes.
  • /gcart for managing properties of minecarts.
  • /grail for changing the states of rails and block by querying properties of minecarts.
  • /glocate for locating blocks and carts for debug purposes.

Additionally, some commands can take optional properties to finetune the use of a command. Those take the form of #name=value and are put directly after the subcommand, e.g. /gcart set #distance=20 IC10.

Administration – /gregorail

These commands are used for plugin administration.

/gregorail reload

Reloads the configuration of the plugin, located in plugins/GregoRail/config.yml.

/gregorail version

Displays the current installed version and API version of the plugin.

Managing tags for minecart codes – /gtag

These commands are used to define code tags for minecart codes. The following properties are currently supported by code tags:

Name Description
name Display name that is used for a minecraft with this code, or displayed in a cart prompt.
url URL to a website that contains more information about the code tag, i.e. a wiki or trip planner.

/gtag list

Lists the currently defined tags for minecart codes.

/gtag set <code> <name> <value>

Sets a property for the specified code tag to the value provided.

Parameters

  • code: string: The code tag to set the property in. Codes can only use alphanumeric characters and underscores ([A-Za-z0-9_] if you speak regex).
  • name: string The name of the property to change.
  • value: string: The value of the property to change. This parameter can contain spaces and uses the remainder of the parameters.

/gtag clear <code> <name>

Clears a property for the specified code tag.

Parameters

  • code: string: The code tag to clear the property in. Codes can only use alphanumeric characters and underscores ([A-Za-z0-9_] if you speak regex).
  • name: string The name of the property to clear.

/gtag remove <code>

Removes the specified code tag.

Parameters

  • code: string: The code to remove the display name from.

Managing minecarts – /gcart

These commands are used to assign codes to minecarts or to control properties of minecarts based on their own code.

/gcart set <code> [location]

Sets the code for the nearest minecart at the specified location unconditionally.

Parameters

  • code: string: The code to set to the minecart.
  • location: location (optional): The location to use for selecting the nearest minecart. When omitted, the location of the command sender will be used. When the sender is a player riding a minecart, that minecart will be used in the command.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.

/gcart setif <query> <code> [location]

Sets the code for the nearest minecart at the specified location only if that minecart matches the query. This command has support for multiple conditional branches defined with the || separator, e.g. /gcart setif IC* IC10 || RE* IC11 ~.

Parameters

  • query: query: The query to match the nearest minecart against.
  • code: string: The code to set to the minecart.
  • location: location (optional): The location to use for selecting the nearest minecart. When omitted, the location of the command sender will be used. When the sender is a player riding a minecart, that minecart will be used in the command.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.
  • #distance: int: Override the default range of searching for minecarts, as configured in the plugin configuration.

/gcart clear [location]

Clears the code for the nearest minecart at the specified location unconditionally.

Parameters

  • location: location (optional): The location to use for selecting the nearest minecart. When omitted, the location of the command sender will be used. When the sender is a player riding a minecart, that minecart will be used in the command.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.

/gcart clearif <query> [location]

Clears the code for the nearest minecart at the specified location only if that minecart matches the query.

Parameters

  • query: query: The query to match the nearest minecart against.
  • location: location (optional): The location to use for selecting the nearest minecart. When omitted, the location of the command sender will be used. When the sender is a player riding a minecart, that minecart will be used in the command.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.
  • #distance: int: Override the default range of searching for minecarts, as configured in the plugin configuration.

/gcart promptset <codes> [location]

Displays a prompt (using an inventory screen) to the nearest player that allows them to set a code to the nearest minecart at the specified location unconditionally.

Parameters

  • codes: string: The codes to display in the prompt that can be set to the minecart. Codes are separated by pipes, e.g. Line1|Line2.
  • location: location (optional): The location to use for selecting the nearest minecart. When omitted, the location of the command sender will be used. When the sender is a player riding a minecart, that minecart will be used in the command.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.

/gcart promptsetif <query> <codes> [location]

Displays a prompt (using an inventory screen) to the nearest player that allows them to set a code to the nearest minecart at the specified location only if that minecart matches the query. This command has support for multiple conditional branches defined with the || separator, e.g. /gcart promptsetif IC* IC10|IC11 || RE* IC11|RE20 ~.

Parameters

  • query: query: The query to match the nearest minecart against.
  • codes: string: The codes to display in the prompt that can be set to the minecart. Codes are separated by pipes, e.g. Line1|Line2.
  • location: location (optional): The location to use for selecting the nearest minecart. When omitted, the location of the command sender will be used. When the sender is a player riding a minecart, that minecart will be used in the command.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.
  • #distance: int: Override the default range of searching for minecarts, as configured in the plugin configuration.

/gcart speed <speed> [location]

Sets the speed multiplier for the nearest minecart at the specified location unconditionally.

Parameters

  • speed: float: The speed multiplier as a number between 0.0 and 4.0.
  • location: location (optional): The location to use for selecting the nearest minecart. When omitted, the location of the command sender will be used. When the sender is a player riding a minecart, that minecart will be used in the command.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.

/gcart speedif <query> <speed> [location]

Sets the speed multiplier for the nearest minecart at the specified location only if that minecart matches the query. This command has support for multiple conditional branches defined with the || separator, e.g. /gcart speedif IC* 2.5 || RE* 2.0 ~.

Parameters

  • query: query: The query to match the nearest minecart against.
  • speed: float: The speed multiplier as a number between 0.0 and 4.0.
  • location: location (optional): The location to use for selecting the nearest minecart. When omitted, the location of the command sender will be used. When the sender is a player riding a minecart, that minecart will be used in the command.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.
  • #distance: int: Override the default range of searching for minecarts, as configured in the plugin configuration.

Managing rails and blocks based on minecarts – /grail

These commands are used to control the environment, such as rail shapes and block materials, based on the code of a minecart that is near the detect location.

/grail switch <shape> <location>

Changes the shape of the rail block at the specified location unconditionally.

Parameters

  • shape: string: A valid rail shape for the rail block to change to.
  • location: location: The location of the rail block to change. Rails, powered rails, detector rails and activator rails are supported.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.

/grail switchif <query> <shape> <location>

Changes the shape of the rail block at the specified location only if a minecart matching the query was found. This command has support for multiple conditional branches defined with the || separator, e.g. /grail switchf IC* south_west || * north_south ~.

Parameters

  • query: query: The query to match when searching for minecarts. The search for minecarts will always initiate at the location of the command sender, so not at the specified location parameter.
  • shape: string: A valid rail shape for the rail block to change to.
  • location: location: The location of the rail block to change. Rails, powered rails, detector rails and activator rails are supported.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.
  • #distance: int: Override the default range of searching for minecarts, as configured in the plugin configuration.

/grail block <material> <location>

Changes the material of the block at the specified location unconditionally.

Parameters

  • material: string: The ID of a block material for the block to change to.
  • location: location: The location of the block to change.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.

/grail blockif <query> <material> <location>

Changes the material of the block at the specified location only if a minecart matching the query was found. This command has support for multiple conditional branches defined with the || separator, e.g. /grail blockif IC* yellow_concrete || * green_concrete ~.

Parameters

  • query: query: The query to match when searching for minecarts. The search for minecarts will always initiate at the location of the command sender, so not at the specified location parameter.
  • material: string: The ID of a block material for the block to change to.
  • location: location: The location of the block to change.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.
  • #distance: int: Override the default range of searching for minecarts, as configured in the plugin configuration.

/grail sound <sound>

Plays a sound at the location of the sender unconditionally.

Parameters

Properties

  • #volume: float: Override the default volume of 1.0 of the played sound.
  • #pitch: float: Override the default pitch of 1.0 of the played sound.

/grail soundif <query> <sound>

Plays a sound at the location of the sender only if a minecart matching the query was found. This command has support for multiple conditional branches defined with the || separator, e.g. /grail soundif IC* minecraft:block.bell.use || * minecraft:block.bell.resonate.

Parameters

  • query: query: The query to match when searching for minecarts. The search for minecarts will always initiate at the location of the command sender, so not at the specified location parameter.
  • sound: string: The ID of a sound to play.

Properties

  • #distance: int: Override the default range of searching for minecarts, as configured in the plugin configuration.
  • #volume: float: Override the default volume of 1.0 of the played sound.
  • #pitch: float: Override the default pitch of 1.0 of the played sound.

Debugging locations – /glocate

These commands are used to locate blocks or minecarts at locations for debugging purposes.

/glocate block <location>

Locates the nearest block from the specified location. This command is useful for debugging if a @block or ^block location resolves to the correct block.

  • location: location: The location to use for selecting the nearest block.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.

/glocate cart <location>

Locates the nearest minecart from the specified location. This command is useful for debugging if a @block or ^block location resolves to the correct minecart.

  • location: location: The location to use for selecting the nearest minecart.

Properties

  • #radius: int: Override the default range of searching for the nearest block for @block and ^block formats, as configured in the plugin configuration.
  • #distance: int: Override the default range of searching for minecarts, as configured in the plugin configuration.

Location parameters

A location parameter, indicated by the location parameter type in the documentation above, specifies the location of a block to change or from which to search for a block or minecart. A location parameter can contain spaces and uses the remainder of the parameters, hence why it is always the last parameter of a command.

Location parameters can take the following forms:

  • X Y Z
    where X, Y, and Z are absolute world coordinates, e.g. 124 64 -855.
  • ~ΔX ~ΔY ~ΔZ
    where ΔX, ΔY, and ΔZ are relative world coordinates using tilde notation. Relative world coordinates can mix with absolute coordinates, e.g. ~2 64 ~-1.
  • @block
    where block is the ID of a block material, e.g. @crimson_hyphae. The location resolves to the nearest block of this material. The range of searching for the nearest block can be configured in the plugin configuration.
  • ^block
    where block is the ID of a block material, e.g. ^crimson_hyphae. The location resolves to one block above the nearest block of this material, which is useful for controlling rails that are on top of a particular block. The range of searching for the nearest block can be configured in the plugin configuration.
  • ~
    which specifies the location of the command sender. This format is logically equivalent to ~ ~ ~, but is shorter to write. Commands with optional and omitted locations default to ~ as the location to use.

Query parameters

A query parameter, indicated by the query parameter type in the documentation above, specifies the code or codes of minecarts that match and for which a rail shape or block material should change. If a minecart with a matching code is found in the query range, the change is made, otherwise the block keeps its original state. The range of searching for minecarts can be configured in the plugin configuration.

Query parameters can take the following formats:

  • code
    matches a single code "code" exact, e.g. IC10.
  • prefix*
    matches all codes that start with the string "prefix", e.g. IC* to match all intercity codes.
  • *suffix
    matches all codes that end with the string "suffix", e.g. *10 to match all codes ending in "10".
  • *match*
    matches all codes that contain the string "match", e.g. *RE* to match all codes containing "RE".
  • code1|code2
    matches one of the alternatives separated by pipes, e.g. IC10|IC11.
  • *
    matches any cart. This query is useful as a catch-all when using multiple conditional branches.

All of the query formats can be combined in a query, e.g. IC10|IC11|RE*, matches "IC10" or "IC11" exact, or all codes that start with "RE".

Conditional branches

Some conditional commands support multiple conditional branches. This means that one of the defined branches is executed depending on which query matches against the nearest cart.

Branches are defined by spearating a pair of query and value with a || separator, e.g.:

/grail switchif IC10 south_west || RE* south_east || * east_west ^red_concrete

This command will set the rail shape of a rail on top of red concrete to south_west if the code of the nearest minecart matches IC10 exact, or to south_east if the code starts with RE, or to east_west otherwise. The * query acts as a catch-all in this case; if there is no query that matches the code of the nearest minecart, nothing is changed.

If you're familiar with coding, such a command can be best viewed as the following pseudocode:

if code matches "IC10" then
  set rail shape to "south_west"
else if code matches "RE*" then
  set rail shape to "south_east"
else
  set rail shape to "east_west"

Permissions

All commands have matching permission nodes which are granted by default, except the /gregorail command, which only has one overarching permission node and is only granted to server operators. The permission nodes are the following:

  • gregorail.admin: Allows the use of /gregorail. Defaults to ops.
  • gregorail.tag: Allows the use of all subcommands of /gtag. Defaults to ops.
    • gregorail.tag.list: Allows the use of only /gtag list.
    • gregorail.tag.set: Allows the use of only /gtag set.
    • gregorail.tag.remove: Allows the use of only /gtag remove.
    • gregorail.tag.clear: Allows the use of only /gtag clear.
  • gregorail.cart: Allows the use of all subcommands of /gcart.
    • gregorail.cart.set: Allows the use of only /gcart set and /gcart setif.
    • gregorail.cart.clear: Allows the use of only /gcart clear and /gcart clearif.
    • gregorail.cart.promptset: Allows the use of only /gcart promptset and /gcart promptsetif.
    • gregorail.cart.speed: Allows the use of only /gcart speed and /gcart speedif.
  • gregorail.rail: Allows the use of all subcommands of /grail.
    • gregorail.rail.switch: Allows the use of only /grail switch and /grail switchif.
    • gregorail.rail.block: Allows the use of only /grail block and /grail blockif.
    • gregorail.rail.sound: Allows the use of only /grail sound and /grail soundif.
  • gregorail.locate: Allows the use of all subcommands of /glocate.
    • gregorail.locate.block: Allows the use of only /glocate block.
    • gregorail.locate.cart: Allows the use of only /glocate cart.