FlashyReese / CommandAliases

Alternate short commands for complex commands
MIT License
25 stars 6 forks source link

Unable to get [{this::SELF}] and messages working. #28

Closed u0398 closed 2 years ago

u0398 commented 2 years ago

Trying the example /staffchat alias generates a message, but [{this::SELF}] does not insert the player's name.

The example /tools alias works, but "message": produces no output.

This was tested on a 1.19 Fabric server running Command Aliases 0.7.0

commandaliases.txt

FlashyReese commented 2 years ago

Trying the example /staffchat alias generates a message, but [{this::SELF}] does not insert the player's name.

I would recommend moving to COMMAND_CUSTOM, it would look something like this.

{
    "commandMode": "COMMAND_CUSTOM",
    "customCommand": {
        "parent": "staffchat",
        "permission": 1,
        "message": "Try using /staffchat <Message>",
        "children": [
            {
                "child": "message",
                "type": "argument",
                "argumentType": "minecraft:greedy_string",
                "actions": [
                    {
                        "command": "tellraw @a[team=staff] {\"text\":\"[$executor_name()] {{message@jsonEscape}}\"}",
                        "commandType": "CLIENT"
                    }
                ]
            }
        ]
    }
}

But if you would like to use COMMAND_ALIAS then.

  {
    "commandMode": "COMMAND_ALIAS",
    "aliasCommand": {
      "command": "staffchat {arg::minecraft:message#message}",
      "execution": [
        {
          "command": "tellraw @a[team=staff] {\"text\":\"[{this::SELF}] {message@jsonEscape}\"}",
          "type": "CLIENT",
          "ignoreOptionalRemoval": true
        }
      ]
    }
  }

The example /tools alias works, but "message": produces no output.

This seems to being working fine? image

but I would still recommend switching to COMMAND_CUSTOM using

{
    "commandMode": "COMMAND_CUSTOM",
    "customCommand": {
        "parent": "tools",
        "actions": [
            {
                "command": "give $executor_name() minecraft:wooden_sword",
                "commandType": "SERVER"
            }
        ],
        "message": "Here are some free wooden tools, $executor_name()!"
    }
}
u0398 commented 2 years ago

Switching to COMMAND_CUSTOM worked.

Thank you for the help, and making an amazing mod!

FlashyReese commented 2 years ago

If you need any further assistance you can join the Discord server. The wiki isn't quite complete as the mod is still technically not 1.0.0 and I won't be able to reply instantly but I will when I can.