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

Effect Command API Enhancement & Skript Event Support #6587

Open
wants to merge 12 commits into
base: dev/feature
Choose a base branch
from

Conversation

NotSoDelayed
Copy link
Contributor

Description

This PR provides enhancements on how Effect Commands are handled, and adds Skript event support for users to listen to.

API Change: EffectCommandEvent
Currently, this event is only called whenever the parsed effect is valid. With this PR, the event is now called whenever an effect command attempt is done. The said event class now has a nullable Effect field to determine whether the parsed effect is valid. Due to this change, EffectCommandEvent#setCommand(String) has been removed due to unavailable better alternative to retain this method whilst returning the parsed effect.

Skript Event Support
With this PR, users are able to listen to EffectCommandEvent.

Event values:

  • event-sender -- returns the effect command executor (player/console)
  • [the] command -- from ExprCommand, returns the string command

Syntaxes:

  • Condition: [the] effect [command] is [not:(not |in)]valid -- checks whether the parsed effect command in EffectCommandEvent is valid

Target Minecraft Versions: any
Requirements: none
Related Issues: none

@sovdeeth sovdeeth added the feature Pull request adding a new feature. label Apr 19, 2024
Copy link
Member

@Moderocky Moderocky left a comment

Choose a reason for hiding this comment

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

I don't really like the idea of adding more effect command things for scripts but I won't stop it from happening if everybody else approves.

else
sender.sendMessage(ChatColor.RED + "Error in: " + ChatColor.GRAY + SkriptColor.replaceColorChar(command));
log.printErrors(sender, "(No specific information is available)");
sender.sendMessage(ChatColor.RED + "Your effect command '" + SkriptColor.replaceColorChar(command) + "' was cancelled.");
Copy link
Member

Choose a reason for hiding this comment

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

These error messages probably ought to be lang entries, but it's okay if you feel that's out of scope for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seeking for extended support of this in the skriptlang channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull request adding a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants