Commands

Create custom commands

MechanicsEverywhere lets you create custom commands which trigger Mechanics. This allows you to create instruction commands, visual effects, and other fun admin tools. This can also be used to give donator perks. To add a command, go into this folder:

your server -> plugins -> MechanicsEverywhere -> commands

And create a new .yml file. Then, you can use these options:

<label>:
  Description: <String>
  Permission:
    Name: <String>
    Description: <String>
    Default: <TRUE/FALSE/OP/NOT_OP>
  Aliases:
    - "alias1"
    - "alias2"
    - "etc"
  Mechanics: <Mechanics>
  Allow_Targeter: <NONE/ENTITY/ENTITIES/PLAYER/PLAYERS>  
  Subcommands:
    <label1>: <Command> # This uses all of the options ^
    <label2>: <Command> # ^
    <etc>: <Command>
  Help:
    Color: "<gold>" # Any color code and/or format code
    Accent: "<gray>"
    Symbol: <String>

<label>

The label is the unique name for your command, and how you will spell it in Minecraft. So if you use tpa for the label, you will use /tpa in-game.

Description

A generalized description of what the command does. This is optional, but you should use it if you want to use the Help feature.

Permission

A custom permission which is required to run the command. If you use a permission that already exists (for example, essentials.fly from EssentialsX), make sure you do not use the Description and Default options, since they will override the values.

  • Name -> The name of the permission, like mechanicseverywhere.myawesomecommand

  • Description -> A short description of what the permission does (For permission managers).

  • Default -> Who has this permission by default (see below)? Defaults to OP.

All players have permission by default.

Aliases

A list of "alternative shorthand names" for your command. For example:

teleport:
  #<other options go here>
  Aliases:
    - tp

Mechanics

The "meat" of the command, or what actually happens. You can use mechanics to:

  1. Run other commands

  2. Play sounds/spawn particles/play effects

  3. Apply potions/damage/movement

Use the Mechanics wiki, and look at the examples below.

  • @Source{} -> The entity who executed the command.

  • @Target{} -> Depends on Allow_Targeter, but none by default.

Allow_Targeter

Consider the custom command /murder, which kills any targeted entity. When you use it in game, you may want to target only zombies, so you run something like:

/murder @e[type=minecraft:zombie]

In this case, you would want to target multiple entities:

  Allow_Targeter: ENTITIES

No targeter is allowed.

Subcommands

Consider the vanilla command /effect (Which gives potion effects). The /effect command has 2 subcommands:

  1. give -> Gives potion effects.

  2. clear -> Clears potion effects.

Now let's create a command /nv, which turns on night vision. We can run /nv on to turn it in, or /nv off to turn it off. Let's see how we can do that with subcommands:

nv:
  permission:
    name: "mechanicseverywhere.commands.nv"
  Subcommands:
    on:
      Mechanics:
        - "Potion{potion=NIGHT_VISION, time=1728000}" # 1 day, in ticks
    off:
      Mechanics:
        - "RemovePotion{potion=NIGHT_VISION}"

Subcommands have all the same options as normal commands, except you can only use Help on the root command. Subcommands cannot use Help.

Help

When you use this option, a "help menu" will be automatically generated for your command, which can be accessed by adding help or ? after the command.

  • Color -> The main color, used for "identifying" information.

  • Accent -> The accent color, used for longer names/descriptions.

  • Symbol -> The symbol used for lists, defaults to .

WeaponMechanics uses <gold> for the main color, and <gray> for the accent color. Since we use MiniMessage to parse colors, you can use hex and styles:

Last updated