FlashyReese / CommandAliases

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

[Feature Request] Cooldown for command #32

Closed Thspooks closed 2 years ago

Thspooks commented 2 years ago

It would be cool having that, and from what i see its not a thing atm

FlashyReese commented 2 years ago

I won't consider this feature request because it does not fit the mission of the mod.

Technically there is a way to do this right now but it's really hacky(it will break if the server restarts and the command don't have fallbacks). By using action event checks and the database

{
  "commandMode": "COMMAND_CUSTOM",
  "customCommand" : {
    "parent": "example",
    "actions": [
      {
        "command": "commandaliases database contains $executor_name().used_example_command",
        "commandType": "SERVER",
        "successfulActions": [
          {
            "command": "say You can't use this command yet!",
            "commandType": "SERVER"
          }
        ],
        "unsuccessfulActions": [
          {
            "command": "say Something happens here? tools? idk?",
            "commandType": "SERVER",
            "requireSuccess": true
          },
          {
            "command": "commandaliases database put $executor_name().used_example_command true",
            "commandType": "SERVER",
            "requireSuccess": true
          },
          {
            "triggerTime": "60000",
            "command": "commandaliases database delete $executor_name().used_example_command",
            "commandType": "SERVER"
          }
        ]
      }
    ]
  }
}

Quite hacky