randombyte-developer / command-utils

A Sponge plugin.
https://ore.spongepowered.org/RandomByte/CommandUtils
GNU General Public License v2.0
6 stars 1 forks source link

Bug with arguments #7

Open ChefMC opened 6 years ago

ChefMC commented 6 years ago
    "i {0}" {
        commands=[
            "give $p {0} 1"
        ]
        permission=""
    }
    "i {0} {1}" {
        commands=[
            "give $p {0} {1}"
        ]
        permission=""
    }

Second command alias is not working. It prints error about that alias is already defined, but this aliases have different arguments count, so they are different

ChefMC commented 6 years ago

Also I can suggest you BetterAlias plugin for Bukkit to get inspired from it abilities and configuration format. Best alias plugin that I ever seen

randombyte-developer commented 6 years ago

Right, I've got to see what's going on there.

Until then I can suggest you to use KtSkript to define the command. It offers command argument completion for all the item types.

https://forums.spongepowered.org/t/ktskript-endless-customizations-for-your-server/24185

registerCommand("i") {
  arguments(catalogedElement<ItemType>("item"), optional(integer("amount"))
  action(onlyPlayers = true) {
    val item = argument<ItemType>("item")
    val amount = arguments.getOne<Int>("amount").orElse(1)
    player.executeCommand("give ${player.name} ${item.id} $amount")
  }
}

Put that into a file like aliases.ktskript into the 'scripts' folder.