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

Migrate to Brigadier Commands #1504

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

StudentAlleg
Copy link
Collaborator

@StudentAlleg StudentAlleg commented Feb 16, 2025

WIP
Create Brigadier Framework for use in BetterPvP code. Create proof of concept loaders, custom argument types, and commands.

TODO:

  • Figure out how to do async in commands
  • Figure out how to use completable futures in arguments compleations (might need to be above)
  • Figure out why suggestions just break in brigadier info (but not elsewhere) (might be something to do with ClanArgument

Commands

Clan

Admin

  • add outskirts
  • admin logs
  • recovery
  • clans of players
  • players of clans
  • rename
  • setadmin
  • setdominance
  • setenergy
  • setexp
  • setsafe

General

  • Bank
  • Help
  • core
  • create
  • info
  • join
  • kill logs
  • list
  • leave
  • logs
  • stuck

Management

  • Ally
  • Banner
  • Claim
  • demote
  • disband
  • enemy
  • invite
  • kick
  • neutral
  • promote
  • setcore
  • trust
  • unclaim
  • untrust

Features

  • Value hints for numbers
  • Only show relevant suggestions (i.e. in promote, only members you can promote, or in neutral, only clans you can neutral)
  • Full type checking in arguments
  • Full type checking for built in types (i.e. doubles)
  • Fine tune permissions to only show commands actually usable (i.e. cannot create a Clan while in a Clan)
  • Allow multiple types of suggestions, allow arguments to be different types (i.e. get type hints for /c info for both players and Clans)
  • Allow admins to use selectors

Players will get more relevant suggestions
Staff will get access to selector arguments and better type hints for things like customeffect.

Development will shift towards fully parsing/checking values in the argument type (as paper updates), so that this code is not duplicated in commands.

Fixes #1420

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested my changes.

@StudentAlleg StudentAlleg force-pushed the student/feat/brigadier-commands branch 9 times, most recently from 36ccf74 to be49ba7 Compare February 23, 2025 21:42
@StudentAlleg StudentAlleg force-pushed the student/feat/brigadier-commands branch 3 times, most recently from b9face2 to df46e8c Compare February 28, 2025 21:35
@Mykindos Mykindos requested a review from Copilot March 1, 2025 13:07
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR migrates clan command functionality to the Brigadier framework and implements a proof‐of‐concept for custom argument types and asynchronous handling. Key changes include:

  • Introducing multiple Brigadier subcommands for clan management (create, promote, invite, join, etc.).
  • Updating utility methods and error handling in ClanManager and Clan to support Brigadier command requirements.
  • Enhancing asynchronous behavior and command suggestion mechanisms.

Reviewed Changes

File Description
clans/…/commands/subcommands/brigadier/BrigadierClanSubCommand.java Base class for Brigadier clan subcommands; integrates client/clan checks.
clans/…/ClanManager.java Updated command-related methods and added exception-based validations.
clans/…/brigadier/admin/BrigadierSetDominanceCommand.java Implements admin command for setting clan dominance.
clans/…/BrigadierClansCommand.java Main Brigadier command registration with alias support.
clans/…/brigadier/management/BrigadierTrustCommand.java Implements trust functionality using Brigadier.
clans/…/brigadier/management/BrigadierDemoteSubCommand.java Implements demotion command with rank checks.
clans/…/brigadier/management/BrigadierNeutralCommand.java Implements neutral command for allied/enemy clan relationships.
clans/…/brigadier/management/BrigadierInviteSubCommand.java Implements invite command with permission and validation logic.
clans/…/brigadier/management/BrigadierAllyCommand.java Implements ally command logic using clan manager validations.
clans/…/brigadier/general/BrigadierCreateSubCommand.java Implements clan creation command with asynchronous filtering.
clans/…/brigadier/management/BrigadierKickSubCommand.java Implements kick command with updated UUID usages.
clans/…/brigadier/management/BrigadierPromoteSubCommand.java Implements promotion command with confirmation menu for leadership changes.
clans/…/Clan.java Updates member lookup methods and fixes UUID handling in message functions.
clans/…/brigadier/general/BrigadierJoinSubCommand.java Implements join command with dual argument support based on permissions.
clans/…/brigadier/general/BrigadierInfoSubCommand.java Implements info command with custom suggestion handling for clans/players.
clans/…/DisbandClanSubCommand.java Updates disband command with improved UUID comparisons.
clans/…/auctionhouse/ClansAuctionListener.java Updates auction listener to use correct UUID types.
clans/…/Clans.java Loads Brigadier commands via the new BrigadierClansCommandLoader.
clans/…/commands/subcommands/KickSubCommand.java Updates kick command UUID handling.
clans/…/commands/subcommands/UnclaimSubCommand.java Updates unclaim command UUID handling.

Copilot reviewed 79 out of 79 changed files in this pull request and generated 2 comments.

…ayers have permission to use that argument, mirrored statics there for consistency. Update documentation, temporary fix for CommandListener preventing non-opped players from using commands.
… do checking entirely in argument. Add disband, enemy, setcore, and leave. Add admin arguments for promote, kick, and demote.
@StudentAlleg StudentAlleg force-pushed the student/feat/brigadier-commands branch from 738dd10 to a103668 Compare March 6, 2025 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Intake
Development

Successfully merging this pull request may close these issues.

Migrate Commands to Brigadier
1 participant