Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commands Rework #7032

Draft
wants to merge 15 commits into
base: dev/feature
Choose a base branch
from
Draft

Commands Rework #7032

wants to merge 15 commits into from

Conversation

sovdeeth
Copy link
Member

@sovdeeth sovdeeth commented Sep 3, 2024

Description

The long-awaited command rework! This PR serves as a tracker for work done, and individual command rework PRs should be merged into this branch instead of directly to dev/feature.

Existing work:

Prior to this PR, some work has already been done towards the command rework.

  • Pickle put a decent amount of effort into decoupling the existing system from Bukkit, though it is by no means complete.
  • Sovde refactored command cooldowns to allow more control and flexibility, and allowing users to access more info about cooldowns.

Work to be done:

This PR is in a draft as details have not yet been hammered out, but the current goals are to provide the following:

  • integrated tab complete using a section
  • choice arguments that auto-supply tab completions (optional/required literals also auto-supply)
  • validation section that allows you to use whatever logic you want as well as ensure x (like asserts) to add on to the default argument parsing restrictions
  • subcommands that allow you to use command tree logic
  • Full decoupling from Bukkit
    • Possible addition of Brigadier integration
  • Full or nearly full back-compatibility with existing commands.

These are not final and are purposely slightly vague, as more discussion needs to occur before deciding on exact courses. This PR will be updated semi-regularly to reflect the current state of affairs. The following is a rough idea of what these goals would look like in a final form, though, again, details and implementation are subject to change. This, too, will be updated semi-regularly.

command /action:
  permission: server.admin

  subcommand (do|delete) <text>:
    tab complete:
      set completions for arg 1 to {fields::*}
    validation:
      ensure {fields::*} contains arg 1 with error "invalid action"
    usage message: "please input an action name"
    trigger:
      if choice 1 is "do":
        do arg 1
      else
        delete arg 1

  subcommand add <action:text>:
    validation:
      ensure {fields::*} doeesn't contain {_action} with error "action already exists"
    trigger:  
      add arg 1 to {fields::*}

  subcommand list:
    trigger:
      send {fields::*}

  default trigger:
    send {fields::*}

Feedback and opinions welcome as comments on this PR, in the skriptlang-development channel on the skUnity discord, or in the SkriptLang testing discord.


Target Minecraft Versions: any
Requirements: none
Related Issues: #6934, #6560, #4830, #3894, #3642, #3408, #2809, #2155, #1197, closes #3408, closes #2809

APickledWalrus and others added 11 commits August 2, 2023 14:35
i haven't touched this in months but it looks like a solid base, need to get it updated to master
Pulls cooldown logic out of ScriptCommand and into its own event.

Allows varied end dates for each player to give users more control without destroying the usefulness of lastUsage.
I hope I'm not making a bunch of poor choices
@sovdeeth sovdeeth added enhancement Feature request, an issue about something that could be improved, or a PR improving something. feature Pull request adding a new feature. parent A pull request for a major feature or change that requires multiple PRs to complete. labels Sep 3, 2024
* initial changes to allow pr creation

* cleanup 1
# Conflicts:
#	src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java
#	src/main/java/ch/njol/skript/effects/EffCancelCooldown.java
#	src/main/java/ch/njol/skript/expressions/ExprAllCommands.java
#	src/main/java/ch/njol/skript/expressions/ExprCmdCooldownInfo.java
#	src/main/java/ch/njol/skript/expressions/ExprCommand.java
#	src/main/java/org/skriptlang/skript/commands/elements/ExprArgument.java
#	src/main/java/org/skriptlang/skript/commands/elements/ExprCommandInfo.java
#	src/main/java/org/skriptlang/skript/commands/elements/StructCommand.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. feature Pull request adding a new feature. parent A pull request for a major feature or change that requires multiple PRs to complete.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants