Skip to content

Commands

McHorse edited this page Jul 28, 2021 · 7 revisions

Mappet provides a lot of commands to work with its features. This page lists all commands that are available in the mod. /mp is the main command that provides many subcommands to work with specific features.

State commands

/mp state command provides subcommands that allows to modify states. <target> can be either a target selector that points out to a unique player or an NPC (it could also be a player username or entity UUID), or ~, which stands for server's global states.

/mp state add <target> <id> <number>

Adds some numerical value to <id> state.

/mp state clear <target> [id]

Removes the <id> state from <target>'s states. If [id] was omitted (not provided) then all states will be removed.

[id] supports * wildcard masks which allow to remove multiple entries. For example you have following global (~) states:

quests.main=1
quests.secondary=2
mchorse.a=10
mchorse.b=20
mchorse.c=30
minecraft.a=10
minecraft.b=20

If you want to remove all states starting with mchorse., you'll need to execute /mp state clear ~ mchorse.* command.

/mp state if <target> <id> <expression>

Checks whether <id> state is equal to <expression>, if it's not then command will error, otherwise nothing will happen.

/mp state print <target>

Outputs into the chat all the states that <target> has. The type of every state will also be printed:

  • (n) is for number
  • (s) is for string.

/mp state set <target> <id> <value>

Sets the exact <value> to <id> state. It can be either numerical, or a string (including consequent spaces).

/mp state sub <target> <id> <number>

Subtracts some numerical value from <id> state.

Dialogue commands

/mp dialogue command provides subcommand to work with dialogues.

/mp dialogue open <target> <id> [data]

Opens a dialogue by given <id> for player(s) found by <target> selector. [data] allows pass extra data to dialogue's context which can be used in ${...} parsed expressions.

Crafting commands

/mp crafting command provides subcommands to work with crafting tables:

/mp crafting open <target> <id>

Opens a crafting table by given <id> to player(s) by <target> selector.

/mp crafting drop <id> [index] [x] [y] [z] [mx] [my] [mz]

Drops an item in the world at [index] from crafting table by <id> at given XYZ, relative offset ~ is supported. If [index] omitted or inputted as @r will drop a random item. [mx], [my] and [mz] can be used to set initial item(s)' velocity.

Event commands

/mp event command provides a subcommand to work with events:

/mp event trigger <target> <id> [data]

Triggers an event by <id> with additional context in form of player(s) found using <target> selector. Additional NBT [data] can be sent to the event execution.

Quest commands

/mp quest command provides subcommands to work with quests:

/mp quest accept <target> <id>

Makes player(s) by <target> selector take quest by <id>.

/mp quest decline <target> <id>

Makes player(s) by <target> selector decline quest by <id>.

/mp quest complete <target> <id>

Makes player(s) by <target> selector complete quest by <id> regardless of whether goals were finished.

NPC commands

/mp npc command provides subcommands to work with NPCs:

/mp npc summon <id> [state] [x] [y] [z]

Spawns an NPC with given [state] (if omitted it's default), and optional position (if XYZ position is omitted command sender's current position will be used).

/mp npc state <target> [state]

Changes state of NPC entities found by <target> selector, with [state]. [state] can contain special notation in form of <state_name>:[properties...] which should allow to overwrite only specific properties of the NPC.

/mp npc set <target> <property> [data...]

Changes specific <property> of NPC entities found by <target> selector, with [data...]. The format of [data...] is completely depends upon the given <property>.

/mp npc despawn <target>

This command despawns (instantly kills without death animation) all NPCs which were found by <target> selector.

Faction commands

/mp faction command provides subcommands to work with factions:

/mp faction set <target> <id> <score>

Sets the score of faction by <id> for player(s) found by <target> selector with <score>.

/mp faction add <target> <id> <score>

Adds <score> to faction by <id> for player(s) found by <target> selector.

/mp faction clear <target> [id]

Removes faction(s) score from player(s) found by <target> selector. If [id] is provided, then only that faction will be cleared, if [id] is omitted then all factions score will be cleaned.

Data commands

/mp data is a utility command that allows to load and save player states for debugging purposes.

/mp data clear [inventory]

Resets all data of the entire playthrough. Global states will be fully reset, and every player's (even those who are offline) states, quests and optionally inventory (depending on [inventory]) will be reset as well. By default, inventories are not cleared unless you execute /mp data clear true.

/mp data save <preset>

Saves current state and current player's inventory and quests.

/mp data load <preset> [global] [player]

Loads saved state and applies saved quests and inventory on given [player] (if [player] is omitted then the command will use the player that executed the command). [global] option allows to specify whether server states should be also updated from the saved state, by default it's enabled.

/mp data rencode <from> <to>

Re-encodes all the data files within world's mappet/ folder from charset <from> to <to> charset.

This isn't an essential command, but was added due to character encoding issues with the first map by Creman, where the map had text display issues that appeared as gibberish because of Creman's system used Windows-1251 encoding, while other people used other than Windows-1251 encoding system-wide.

Script commands

/mp script command provides a subcommand to work with scripts:

/mp script exec <player> <id> [function] [data]

Executes script's [function] (if not provided it will be assumed to be main) by <id> with additional context in form of player(s) found using <player> selector. Additional NBT [data] can be sent to the event execution and accessed using IScriptEvent#getValues().

/mp script eval <code...>

Evaluates given JS <code...>. c variable is available which is a IScriptEvent which contains either a player as a subject, or just server (depending on who executed that command).

IMPORTANT: the command should be available only for OP players, and to non-player mechanisms that can execute commands (like command blocks, trigger, events, etc.) however it's not 100% certain that this command is safe, so make frequent backups.

Clone this wiki locally