-
Notifications
You must be signed in to change notification settings - Fork 0
Ff #3
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
Ff #3
Conversation
Reviewer's GuideThis PR restructures alias management by enhancing config handling, refactoring alias execution to support JSON arrays and variable substitution (including per-player custom variables), improving command registration logic, and updating the build for Quilt compatibility with a version bump. Sequence diagram for executing an alias with variable substitution and multiple commandssequenceDiagram
actor Player
participant ServerCommandSource
participant ExampleMod
participant CommandDispatcher
Player->>ServerCommandSource: Issues alias command
ServerCommandSource->>ExampleMod: executeAlias(alias, ctx)
ExampleMod->>ExampleMod: Parse alias value (JSON string/array)
loop For each command in alias
ExampleMod->>ExampleMod: substituteVariablesWithArgs(cmd, ctx, args)
ExampleMod->>CommandDispatcher: parse(substitutedCmd, source)
CommandDispatcher->>CommandDispatcher: execute(parsed)
end
ExampleMod->>ServerCommandSource: Return result
Sequence diagram for setting a per-player custom variable via /setcmdvariablesequenceDiagram
actor Player
participant ServerCommandSource
participant ExampleMod
Player->>ServerCommandSource: /setcmdvariable <variable> <value>
ServerCommandSource->>ExampleMod: registerSetCmdVariable()
ExampleMod->>ExampleMod: Store variable in playerVariables[uuid]
ExampleMod->>ServerCommandSource: Send feedback to player
Class diagram for updated ExampleMod alias and variable managementclassDiagram
class ExampleMod {
+MOD_ID : String
+LOGGER : Logger
-CONFIG_PATH : Path
-aliases : Map<String, String>
-playerVariables : Map<UUID, Map<String, String>>
+onInitialize()
-ensureConfigExists()
-registerAddCommand(CommandDispatcher)
-registerSetCmdVariable(CommandDispatcher)
-registerAliases(CommandDispatcher)
-registerAlias(CommandDispatcher, String, String)
-executeAlias(String, CommandContext)
-substituteVariablesWithArgs(String, CommandContext, String[])
-substituteVariables(String, CommandContext)
-loadAliases()
-saveAliases()
}
ExampleMod --> "*" Map
ExampleMod --> "*" Path
ExampleMod --> "*" UUID
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- Consider extracting and reusing the duplicate logic in substituteVariablesWithArgs and substituteVariables into a single utility method to avoid code duplication.
- The playerVariables map is never cleared—consider removing entries on player logout to prevent unbounded memory growth over time.
- The header comments for the config file are duplicated in ensureConfigExists() and saveAliases(); extract them into a single constant to keep them in sync.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting and reusing the duplicate logic in substituteVariablesWithArgs and substituteVariables into a single utility method to avoid code duplication.
- The playerVariables map is never cleared—consider removing entries on player logout to prevent unbounded memory growth over time.
- The header comments for the config file are duplicated in ensureConfigExists() and saveAliases(); extract them into a single constant to keep them in sync.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Enhance command alias mod with robust config management, multi-command and dynamic variable support, and Quilt compatibility
New Features:
Enhancements:
Build: