-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored inventory interaction event blocking system (#37)
* Add click and action filtering in SGMenu Introduced permittedMenuClickTypes, blockedMenuActions, and blockedAdjacentActions arrays in SGMenu to handle specific click and action types. Refactored SGMenu constructors to support these new features and updated event handling to utilize the new arrays for more flexible and secure menu interactions. * Correct conditional check for permitted menu click types Previously, the constructor incorrectly defaulted to permitted click types if an empty array was passed. The updated check now ensures that `DEFAULT_PERMITTED_MENU_CLICK_TYPES` is used only if no specific click types are provided. * Fix SGMenu constructor to handle permitted click types correctly The constructor now properly checks if permittedMenuClickTypes is non-empty. Previously, an empty array was incorrectly accepted, potentially leading to unintended behavior. This ensures that the default permitted click types are used only when no custom types are provided. * Refactor SGMenuListener to streamline event handling Simplified the SGMenuListener by removing an unnecessary return statement. This change improves code readability without altering the logical flow of blocking specific menu actions. * Refactor SGMenu and SGMenuListener to simplify click and action handling Refactor the `SGMenu` class to change `public` ArrayLists to `private` arrays for `permittedMenuClickTypes`, `blockedMenuActions`, and `blockedAdjacentActions`. Introduce getter and setter methods for these fields to maintain encapsulation. Update references in `SGMenuListener` to use the new getter methods, improving code readability and ensuring better data encapsulation. * Refactor to use HashSet for menu action and click type lists Refactored SGMenu and SGMenuListener to use HashSet instead of arrays for permitted menu click types and blocked actions. This change includes adding methods to add and remove elements from these HashSets, providing better performance and flexibility. Updated related methods and listeners accordingly.
- Loading branch information
1 parent
cbd1050
commit 4ac7764
Showing
3 changed files
with
163 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters