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

ACF Command rework - Done! #2514

Closed
wants to merge 184 commits into from
Closed

ACF Command rework - Done! #2514

wants to merge 184 commits into from

Conversation

benwoo1110
Copy link
Member

@benwoo1110 benwoo1110 commented Dec 20, 2020

This PR moves the entire multiverse commands system to Annotation Command Framework (ACF) made by Aikar. I have been working on this for quite a while now, and its almost done!

Features:

  • Add full tab-completed commands. It can even suggest potential worlds for import command as well as world flags!
  • Add support for vanilla selectors and UUID inputs for all arguments that has player name input previously.
  • Add showing of download links to submodules that have yet to be installed when those commands are ran (e.g. /mvp ...).
  • Add a root command /mv that will show the plugin's version and help command.
  • Add a /mv bed command (replacement for previously broken sleep command). Basically, just teleports you to respawn point.
  • Add a /mv modify list [world] command to display the available property values.
  • Add regex filter to commands that list stuff, such as /mv who, /mv whoall, /mv gamerule list, /mv config list and /mv anchors list.
  • All-round more informative and consistent messaging.
  • Better checks and errors message such as worldName and worldFolder validation showing more specify error reason.
  • Queued Commands has better prompt message and now allow confirming from command blocks properly.
  • Improve displaying of command usage with /mv help <command> command, with per args explanation and tab-complete.
  • Improve list and info displays with more consistent format across the mv modules, regex filter and paging.
  • Improve structure for various command, see section below for more details.

Command changes:

[old => new : reason]

  • /mv version [-p|-h|-g] => /mv version [pastebin|hastebin|pastegg] : Make paste type more readable.
  • /mv coord => /mv coord [player] : View another players location, with separate self and other permission node.
  • /mv config -list => /mv config list [filter]
  • /mv config <property> <value> => /mv config set <property> <value> : Clearer command hierarchy.
  • /mv gamerules [world] => /mv gamerule list [world] [filter]
  • /mv gamerule <property> <value> [world] => /mv gamerule set <property> <value> [world] : Clearer command hierarchy.
  • /mv modify add <value> <property> [world] => mv modify add [world] : Align with the rest of the modify commands.
  • /mv purge all ... => /mv purgeall ... : Possiblilty of a world named all, and provides a clearer structure.
  • /mv who --all => /mv whoall [filter] : Same reason as purge command.
  • /mv who <worldname> => `/mv who [filter]
  • /mv anchors <name> => /mv anchors create <name>
  • /mv anchors => /mv anchors list [filter]
  • /mv anchors -d <anchor> => /mv anchors delete <anchor> : Make anchor command syntax a lot clearer.

Important things to note:

  • One of the goals is also to remove the - styled flags in favour of a proper structure like shown in the above anchor command. However that being said, I will definitely retain is the world generation flags.
  • Remove the used of most aliases so now command is /mv <subcommand> [actions]. EXCEPT for the following that I have retained as I feel it's used very often:
    • /mvsetspawn: alias for /mv setspawn
    • /mvspawn: alias for /mv spawn
    • /mvtp: alias for /mv teleport
  • The formatting for commands usage is different as well, due to the change in command handler. There is no longer add ? behind a command to see its usage.

API Changes:

(changes that effects existing API, does not include new commandTools classes) [Symbols: ~ change, + add, - remove]

New commandTools Package:

Contains all the new classes that handle commands stuff is some way ;)

CommandManagers classes:

flag Package:

Define each world flags such as -g, -s etc... with methods to do tab-complete suggestions and parsing of value.

  • MVFlags: Contains all the world flags by implementing the abstract flag classes.
  • Single abstract flag instance:

contexts:

  • PlayerWorld: Store parsed Player and the MultiverseWorld it is in.
  • WorldFlags: Store parsed world flags settings.
  • PageFilter: Store parsed page and filter, both optional parameters.

queue Package:

Confirm commands before running with an expiry duration. Now uses runnable in favour of old implementation.

display Package:

Customisable display for list and info commands.

Main abstract classes:

  • ContentDisplay: Builder class to set up the attributes such as sender, header, filter which is built into a ShowRunnable.
  • ShowRunnable: Do creating of items and displaying it to the sender.
  • ContentCreator: Supplier that creates the items to show.
  • ContentFilter: Filter each item based on regex matching.
  • ColorAlternator: Flip between 2 colors for some cooler look

Inline implementation: Showing of each item separated with comma.

Page implementation: Showing of each item on a new line with pages.

  • PageDisplay: Builder for a list of items with additional paging attributes.
  • ShowPage: Further abstraction of ShowRunnable with some shared attributes for paging.
  • ShowAllPage: Console doesn't need paging, so just show all the items
  • ShowSelectedPage: Display part of the content based on the page specified.

Sample code:

new ListDisplay().withSender(sender)
        .withHeader(String.format("%s--- Available Generator Plugins ---", ChatColor.GOLD))
        .withCreator(getGeneratorContent(plugin))
        .withColors(new ColorAlternator(ChatColor.AQUA, ChatColor.WHITE))
        .withEmptyMessage(String.format("%sYou do not have any generator plugins installed.", ChatColor.RED))
        .build()
        .run();

Screenshots for some sample outputs:

  • /mv list 2 in-game
    image
  • /mvnp listall in-console
    image
  • /mv config list spawn in-game
    image

Other changes:

TODO list:

You can get the test builds at https://www.benergy10.dev/

@CyberedCake
Copy link

Is this no longer being worked on? Because, as an amateur developer, this looks cool and it looks like it was close to being completed.

@nicegamer7
Copy link
Member

We don't have the free time that we used to have, and this is a really big change that we need to test and review.

So in a way, yes, work has stopped on this, since it hasn't been touched in quite some time. However, that doesn't mean it won't continue, it just means that for the time being, development is paused.

@benwoo1110 benwoo1110 closed this Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0.0 Next major release. PR: Enhancement Pull requests to implement a feature or improvement in code. State: Needs Review By Dev Pull requests requires the approve of lead dev.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tabcomplete [Suggestion] Include option to switch between worldalias and worldname in /mv list
4 participants