Command Items icon

Command Items -----

Create consumable items that trigger commands




Note: This is a rather large update, and as such comes with a high likelyhood of overlooked bugs. If you value stability you may want to wait until these are ironed out. On the other hand i'd be grateful for some feedback ;)

Parameters
This part of the update nobody asked for specifically, but oh well ...

You can now define item parameters which allow you to slightly adjust the behavior of an item when giving it out. For example the jumper example is now:
Code (YAML):
jumper : # This item demonstrates the use of a tool + damage value
    item
:
      type
: DIAMOND_PICKAXE
      name
: "&aJumper"
      lore
: [ "&1Click for some vertical displacement ..." ]
      glow
: true
      unbreakable
: true
      damage
: 50
    parameters
:
      fixedHeight
: 10
      randomOffset
: 5
    consumed
: true
    cooldown
: 20
    actions
:
      - { action
: MATH_EXPR, target : "YOFF", expr : "rand() * randomOffset + fixedHeight", actions : [
        { action
: COMMAND, by : PLAYER_PRIVILEGED, perm : minecraft.command.teleport, command : "tp ~ ~{YOFF} ~" },
        { action
: MATH_EXPR, round : true, target : "YOFF", expr : "YOFF", actions : [
          { action
: MESSAGE, to : PLAYER, message : "&aWeeee ... ouch! (Sent you up roughly {YOFF}m)" }
        ] }
      ] }
Which defines the two parameters fixedHeight and randomOffset, each including their default value. These can then be adjusted when you give out an item like so:

Code (Text):
/cmdi give Yamakaja jumper 1 fixedHeight=200 randomOffset=10
messages.yml

The messages.yml allows you to adjust all user messages, which does *not* include /cmdi output, just cooldown information, etc:

Code (YAML):
item:
  disabled
: "&cThis item has been disabled!"
  nopermission
: "&cYou don't have permission to use this item!"
  # cooldown: "&cYou can only use this item once every $TIME_PERIOD!"
  cooldown
: "&cYou can use this item again in $TIME_REMAINING!"
  error
: "&cSo
Player Heads
If an item is of type PLAYER_HEAD you can specify a user for the texture:

Code (YAML):
 toomanyzombies:
    item
:
      type
: PLAYER_HEAD
      name
: "&c&lZoooombies"
      lore
: [ "&1Make sure you're prepared for what's coming!" ]
      glow
: true
      skullUser
: Zombie
      # skullUser: 02b0e86d-c86a-4ae7-bc41-015d21f80c1c # Alternatively provide the uuid
    consumed
: true
    cooldown
: 30
    parameters
:
      range
: 10
    actions
:
      - { action
: REPEAT, from : 0, to : 31, increment : 1, delay : 0, period : 4, actions : [
        { action
: MATH_EXPR, target : xoff, expr : "x + range * sin(2*pi * i/32) + randn()*range/5", actions : [
          { action
: MATH_EXPR, target : zoff, expr : "z + range * cos(2*pi * i/32) + randn()*range/5", actions : [
            { action
: COMMAND, by : PLAYER_PRIVILEGED, perm : minecraft.command.summon, command : "summon minecraft:zombie {xoff} ~ {zoff}" }
          ] }
        ] }
      ] }
Math expressions

This new action allows for a much more convention form of mathematical operations, for more information see the examples above and the documentation on GitHub: https://github.com/Yamakaja/commanditems#math_expr

You can use the new cmdi subcommand "calc" to play around with expressions! For example to evaluate the gaussian pdf:

Code (Text):
/cmdi calc 1/sqrt(2*pi*sigma^2)*exp(-(x-mu)^2/(2*sigma^2)) mu=0 sigma=5 x=0
Inspect command

The new /cmdi inspect subcommand will show you more information about a command item that you're holding.

Things that you can view:

* Which command (the key in your config.yml) this item is bound to
* Parameters set on that specific item
* An execution trace or summary of the actions that will be taken
----------, Aug 8, 2021

This update adds 1.17 support, see the relevant commit.
----------, Jun 22, 2021

This is a small update that allows you to make items unbreakable

An example can be found here: https://github.com/Yamakaja/commanditems/blob/master/src/main/resources/config.yml#L26-L38
----------, Jul 21, 2020

Additionally, this update fixes the relocation issues in previous versions.
----------, Jul 20, 2020

This update includes some minor fixes and should improve 1.13+ support.

Changes:
* New Material types should work properly now and the data field has been removed from item definitions.
* The example config file has been updated for 1.13+
----------, Jun 10, 2019

This update adds support for Minecraft 1.13 - 1.14.2 (And possibly more, that remains to be seen), at the same time support for versions below 1.13 is removed, you'll have to use CommandItems version 2.0.4 for those.
----------, Jun 6, 2019

Fixes a NPE
----------, Jul 22, 2018

See title
----------, Jul 13, 2018

There isn't much to this update, see the commit for detailed information.
----------, Jul 5, 2018

This update just fixes a minor bug with item glow on restart.

(On 2.0.0 items would not glow immediately after a restart, only after another glowing item was given).
----------, May 28, 2018

This is a complete rewrite of commanditems, making it quite a bit more powerful and including all the features that were frequently requested.

This version is 100% incompatible with CommandItems 1.x!

See the plugin overview page for the new usage information.
----------, May 27, 2018

This update fixes OP commands
----------, Feb 3, 2018

This update adds 1.8 - 1.10 support
----------, Jan 8, 2018

This build fixes an error with PaperSpigot
----------, Jun 27, 2017

Taking up another suggestion by @Cola_Simon: Commands are now stored in NBT, thus not modifying the item lore.

Warning: This will break your existing command items!
----------, Jun 27, 2017

This updated completely changed the commands to subcommands of a main command: /cmdi

Subcommands:
- reload Reloads configs
- msg Replaces /rawmsg
- help Shows the help message
- add Replaces /addcommand

Thanks to @Cola_Simon for the suggestion
----------, Jun 23, 2017

Added statistics tracking using bStats
----------, Jun 22, 2017

The "TRAP" error message (should) have been fixed and a new option has been added to the config (You have to add it manually, if you don't it will default to false):

Code (YAML):
# Whether players have to shift while clicking for the command to activate
shift
: false
----------, Jun 22, 2017

Resource Information
Author:
----------
Total Downloads: 35,288
First Release: Jun 19, 2017
Last Update: Aug 8, 2021
Category: ---------------
All-Time Rating:
64 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings