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

Allow commands to target offline players #1022

Merged
9 commits merged into from
May 22, 2022

Conversation

Birdulon
Copy link
Member

@Birdulon Birdulon commented May 21, 2022

Description

Some commands do not strictly require the target player to be online in order to function. Some don't need a target player at all. Others in the future may want to only target offline players. This PR adds a new annotation to commands such that these different requirements can be expressed more easily. It should also aid with future overhauls like #751 that will want this information ahead of time, rather than just as an error when the commands are called with incorrect targets.

Issues fixed by this PR

Type of changes

  • Bug fix
  • New feature
  • Enhancement
  • Documentation

Checklist:

  • My code follows the style guidelines of this project
  • My pull request is unique and no other pull requests have been opened for these changes
  • I have read the Contributing note and Code of conduct
  • I am responsible for any copyright issues with my code if it occurs in the future.

@Birdulon Birdulon marked this pull request as ready for review May 21, 2022 09:43
@Birdulon
Copy link
Member Author

Sets /account, /broadcast, /help, /language, /list, /reload, /restart, /sendmail and /stop to Command.TargetRequirement.NONE, everything else is using the default value of Command.TargetRequirement.ONLINE for now. Changes to offline Player loading will need to be made before /permission and other commands that make sense to use on offline players can be set to Command.TargetRequirement.PLAYER.

@ghost ghost merged commit afbeaf3 into Grasscutters:development May 22, 2022
@Birdulon Birdulon deleted the CommandTargetOffline branch July 25, 2022 08:04
Birdulon added a commit to Birdulon/Grasscutter that referenced this pull request Aug 21, 2022
* Add targetRequirement annotation for Command

* Added MTL lines for other langs

* Fix TargetRequirement enum scoping

* Adjust commands to targetRequirement system

* Add translation message sugar to prevent future messages from being translated for wrong player

* Temporarily disable offline targeting on /permission and /clear

* Preliminary README cleanup

* Readme commands cleanup

* Clean up command table in README, including column shuffle

Co-authored-by: AnimeGitB <AnimeGitB@bigblueball.in>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant