Skip to content

Optimization and Refactoring of Death Inventory Log Commands#7

Open
Jullius1392 wants to merge 4 commits intoMuqsit:masterfrom
Jullius1392:master
Open

Optimization and Refactoring of Death Inventory Log Commands#7
Jullius1392 wants to merge 4 commits intoMuqsit:masterfrom
Jullius1392:master

Conversation

@Jullius1392
Copy link

This pull request makes significant improvements in the management of Death Inventory Log commands. Separate methods have been created for the "history," "restore," and "view" cases, enhancing code modularity and readability. Additionally, specific methods have been added for retrieving and applying logs to the player, as well as for displaying logs to the command sender. These changes aim to ease maintenance and future expansions of the code.

Changes Made:

  • Refactoring of the main command logic (onCommand).
  • Creation of specific methods for "restore" and "view" cases.
  • Addition of methods for retrieving and applying logs to the player (retrieveAndApplyLog).
  • Addition of a method for retrieving and displaying logs to the command sender (retrieveAndDisplayLog).
  • Improvement in code reuse and overall clarity of Death Inventory Log-related code.

This pull request is ready for review. Comments and suggestions are appreciated.

…entory Log.

Changes made:

1. **onCommand:**
    - Reorganize switch logic to improve clarity.
    - Moved the "history" case code to a new `executeHistoryCommand` method.
    - Added use of `translateGamertags` and `retrievePlayerEntries` directly in the `executeHistoryCommand` method to simplify the logic.

2. **executeRestoreCommand and executeViewCommand:**
    - Separate methods have been created for the "restore" and "view" cases respectively.
    - Each of these methods performs specific actions, improving the modularity of the code.
    - Added a new `retrieveAndApplyLog` method to handle retrieving and applying logs to the player.
    - Added a new `retrieveAndDisplayLog` method to handle retrieving and displaying logs to the command sender.
    - These changes make the code easier to understand and maintain.

3. **applyLogToPlayer and displayLogToSender:**
    - New methods created to encapsulate the logic of applying and displaying records, respectively.
    - These methods improve code reuse and facilitate future modifications.

These changes seek to improve the structure and clarity of the code, as well as facilitate future expansions and maintenance.
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.

1 participant

Comments