Skip to content

/sk Command Rework - #8050

Open
erenkarakal wants to merge 54 commits into
SkriptLang:dev/featurefrom
erenkarakal:feature/skript-command-rewrite
Open

/sk Command Rework#8050
erenkarakal wants to merge 54 commits into
SkriptLang:dev/featurefrom
erenkarakal:feature/skript-command-rewrite

Conversation

@erenkarakal

@erenkarakal erenkarakal commented Jul 17, 2025

Copy link
Copy Markdown
Member

Problem

The current way the /sk command is written makes it nearly impossible to add new features, fix bugs, or even tell what's going on.
There are also lots of issues created for the /sk command that were untouched for a long time.

Solution

Deletes the old SkriptCommand and SkriptCommandTabCompleter classes and replaces them with a new SubCommand class.
To add a new SubCommand, you create a new class for your command and extend SubCommand:

class MyCommand extends SubCommand {

	public MyCommand() {
		super("command", "aliases");
	}

	@Override
	public void execute(@NotNull CommandSender sender, @NotNull String @NotNull [] args) {
		// /sk command or /sk aliases
		sender.sendMessage("You ran this command.");
	}

	@Override
	public List<String> getTabCompletions(@NotNull CommandSender sender, @NotNull String @NotNull [] args) {
		return List.of("tab completions");
	}

}

Then, add your subcommand inside the new SkriptCommand class

For commands that share a lot of code, such as /sk enable | disable | reload, a new ScriptCommandUtils class was added as a utility class.
This approach makes it way easier to work on anything related to the /sk command.

Full Changelog

- list - Lists all enabled and disabled scripts
- show - Lists all enabled and disabled scripts
+ list/show - Lists all enabled and disabled scripts
  • Added a new /sk recover command that dumps all scripts in memory to files, useful for recovering accidentally deleted scripts.
  • Added a new /sk parse <code> command that works the same way as effect commands do, except they don't have to be enabled through the config. (parse effect subcommand #6899)
  • Node#getComment and Node#getIndentation were made public for /sk recover
  • Added missing [Skript] prefixes in /sk reload (Skript errors missing prefix in dev/feature #7297)
  • Server version in /sk info is now more detailed:
- 1.21.8-60-29c8822 (MC: 1.21.8)
+ Paper 1.21.8 #60 (29c8822)

Completes: none
Related: none

@Efnilite Efnilite left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like the new structure, good work 🙏

Comment thread src/main/java/ch/njol/skript/skcommand/ScriptCommand.java Outdated
@Efnilite Efnilite added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Jul 18, 2025
@erenkarakal
erenkarakal marked this pull request as ready for review December 2, 2025 15:55
@erenkarakal
erenkarakal requested review from a team and sovdeeth as code owners December 2, 2025 15:55
@erenkarakal
erenkarakal requested review from TheMug06 and removed request for a team December 2, 2025 15:55
@skriptlang-automation skriptlang-automation Bot added the needs reviews A PR that needs additional reviews label Dec 2, 2025

@sovdeeth sovdeeth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some sections look unfinished with todos or just stubs, is that intentional?
Missing a lot of documentation but otherwise seems pretty good

Comment thread src/main/java/ch/njol/skript/skcommand/DisableCommand.java Outdated
Comment thread src/main/java/ch/njol/skript/skcommand/DisableCommand.java Outdated
Comment thread src/main/java/ch/njol/skript/skcommand/EnableCommand.java Outdated
Comment thread src/main/java/ch/njol/skript/skcommand/ParseCommand.java Outdated
Comment thread src/main/java/ch/njol/skript/skcommand/RecoverCommand.java Outdated
Comment thread src/main/java/ch/njol/skript/skcommand/ScriptCommand.java Outdated

@APickledWalrus APickledWalrus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good overall, great work! I have a few minor formatting suggestions.

I might like to see us move to use the Paper/Brigadier API: https://docs.papermc.io/paper/dev/command-api/basics/introduction/
Though I'm not sure how that might impact the organization of this PR. Could always be done in another future rework.

Comment thread src/main/java/ch/njol/skript/SkriptConfig.java
Comment thread src/main/java/ch/njol/skript/config/Node.java Outdated
Comment thread src/main/resources/lang/english.lang Outdated
Comment thread src/main/resources/lang/english.lang Outdated
Comment thread src/main/java/ch/njol/skript/skcommand/RecoverCommand.java Outdated
Comment thread src/main/java/ch/njol/skript/skcommand/SkriptCommand.java Outdated
Comment thread src/main/java/ch/njol/skript/skcommand/SkriptCommand.java
Comment thread src/main/java/ch/njol/skript/skcommand/ReloadCommand.java Outdated
Comment thread src/main/java/ch/njol/skript/skcommand/EnableCommand.java Outdated
Comment thread src/main/java/ch/njol/skript/skcommand/DisableCommand.java Outdated
@skriptlang-automation skriptlang-automation Bot removed the needs reviews A PR that needs additional reviews label Mar 27, 2026
@sovdeeth sovdeeth removed this from 2.15 Releases Apr 20, 2026
@github-project-automation github-project-automation Bot moved this to In Review in 2.16 Releases Apr 20, 2026
@erenkarakal erenkarakal linked an issue Jun 3, 2026 that may be closed by this pull request
1 task
Comment thread .github/CODEOWNERS Outdated
Comment thread src/main/java/ch/njol/skript/skcommand/DisableCommand.java Outdated
boolean enable = args[0].equalsIgnoreCase("enable");

// Live update, this will get all old and new (even not loaded) scripts
// TODO Find a better way for caching, it isn't exactly ideal to be calling this method constantly

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you plan on doing this for this pr?

Comment thread gradlew.bat

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stopop1!!!!!

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.

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

Skript doesn't play well with Symbolic Links

4 participants