Skip to content

/sk Command Rework#8050

Open
erenkarakal wants to merge 35 commits intoSkriptLang:dev/featurefrom
erenkarakal:feature/skript-command-rewrite
Open

/sk Command Rework#8050
erenkarakal wants to merge 35 commits intoSkriptLang:dev/featurefrom
erenkarakal:feature/skript-command-rewrite

Conversation

@erenkarakal
Copy link
Member

@erenkarakal erenkarakal commented Jul 17, 2025

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 (marked as internal)
  • 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)

TODO List

I created this PR early to get initial feedback on the new structure, and so that people can recommend changes on the old command code. If you have any suggestions for new commands, drop them here.


Completes: none
Related: none

Copy link
Member

@Efnilite Efnilite left a comment

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 🙏

@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
Copy link
Member

@sovdeeth sovdeeth left a comment

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

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. needs reviews A PR that needs additional reviews

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

4 participants