Carpet

Carpet

2M Downloads

Scarpet: Custom commands with 2 custom arguments of the same type will not pass them correctly

BisUmTo opened this issue ยท 2 comments

commented

If in a custom command there are 2 identical custom arguments, it will pass the second one 2 times.

    'stay_loaded' -> true,
    'commands' -> {
        '<Slot> <Slot>' -> _(slot1, slot2) -> print(player(), slot1 + ' ' + slot2)
     },
     'arguments' -> {
        'Slot' -> {
            'type' -> 'term',
            'options' -> ['mainhand', 'feet', 'legs', 'chest', 'head', 'offhand']
        }
    }
};

How to reproduce:

  • create the script with the source ^
  • run the /scriptName command passing 2 arguments

Aspected result: the 2 arguments you choose
Returned result: 2 times the second argument

commented

Argument names are handled in brigadier (vanilla) with a map, so you can't reuse the names. Its in the docs somewhere:

https://github.com/gnembon/fabric-carpet/blob/master/docs/scarpet/Full.md#custom-commands

'Argument names need to be unique for each command...'

commented

use '<from_slot> <to_slot>'
using one custom 'slot' type