Improve the error checking mechanism for the `ChestShopSign` metadata handling by introducing a validation layer. This layer will delay the metadata saving task, allowing the system to verify its correctness before execution, hence improving data integrity. The async task is scheduled with a one tick delay to ensure a smoother operation even under potential exceptions. (commit: 2d073f7) (details)
The string to shorten is now taken literal. Before it was compiled as a regex. We don't need that Complexity in that component. (commit: b92548e) (details)
The displayed itemname in the item info is now the long version of what should be written on the sign. (commit: f8f87f0) (details)
The Maven repository URL for sk89q has been updated from HTTP to HTTPS, to ensure that all artifacts are securely downloaded. This change improves security measures while downloading dependencies. (commit: 2185457)
Add ownership and access management to ChestShopSign
This update introduces new methods to the ChestShopSign class in the ChestShop plugin for handling ownership and access. The isOwner and isAccessor methods leverage persistent data containers and Bukkit's NamespacedKey to identify if a player is the owner or has access to a shop, respectively. It also provides functionality for adding and removing accessors persistently. (commit: 82d8fcd)
This update modifies the ChestShopSign class to improve admin shop detection. By incorporating a new NamespacedKey, ADMINSHOP_NAMESPACED_KEY, and associating it with the sign's persistent data container, the updated code increases the efficiency and reliability of determining if a shop is an admin shop. (commit: 39989ef)
Revised the ChestShopSign class to enhance the process of identifying an admin shop. This involved the new creation and utilization of the NamespacedKey, ADMINSHOP_NAMESPACED_KEY, linked with the sign's persistent data container. The modification improves the performance and accuracy of the admin shop detection. (commit: 0be745e)
The code has been updated to improve the admin shop detection process using a NamespacedKey. This change involves initializing this new NamespacedKey in the ChestShopSign class and using it with the sign's persistent data container. This enhancement will offer an optimized performance and accuracy in identifying admin shops. (commit: ce4387e)
The Maven repository URL for sk89q has been updated from HTTP to HTTPS, to ensure that all artifacts are securely downloaded. This change improves security measures while downloading dependencies.
(cherry picked from commit 2185457af593dbf6281fea23e692baf681ebbe78) (commit: ad1fae9)
Remove unused UUID retrievals methods in NameManager
The methods getUUIDFor and getUUIDForFullName were removed from the NameManager class. These methods were found to be unnecessary or unused. The ChestShopSign class had also been modified to include handling of admin shop sign UUIDs directly, paving the way for more efficient and streamlined admin shop management. (commit: 0e84ac4)
Add method for UUID retrieval and improve sign management
Introduced a function in the NameManager class to fetch UUIDs using short names. In the ChestShopSign class, enhanced the management of admin shop signs by refining checks for the same and optimizing the way in which owner data is stored. This will facilitate easier updating of existing signs, improved admin shops' management, and the efficiency of all operations related to the owner. (commit: 7bea581)
Updated 'isShopMember' function in the ChestShop.java class to check if a player is not only an accessor but also an owner. This modification optimizes and improves sign management; making it more convenient to update existing signs and manage admin shops. (commit: ce71e71)
Add 'setAdminshop' and 'setOwner' functions in ChestShopSign class
Added 'setAdminshop' and 'setOwner' functions in ChestShopSign.java to handle shop ownership and status updates. These new utilities make it easier to manage shop signs by differentiating between admin and player-owned shops and by permitting the direct assignment of owners. (commit: cb363ec)
Update sign immediately in 'setAdminshop', 'setOwner' and 'saveAccessors'
Refactor code in ChestShopSign.java to immediately update sign after changes in functions: 'setAdminshop', 'setOwner', and 'saveAccessors'. This helps to ensure that all the changes are immediately reflected on the respective shop signs. (commit: 9eacee4)
This update includes the implementation of `AddAccessor` and `RemoveAccessor` commands, allowing users to add or remove an accessor from a shop. Additionally, new user messages that tie into these commands have been defined in `Configuration/Messages.java`. Changes have been reflected in plugin.yml file and invoked in the main ChestShop class. (commit: b40420d)
Change data structure in 'saveAccessors' to HashSet
Replaced Arrays.asList with a new HashSet in the 'saveAccessors' function of ChestShopSign.java. This change improves data uniqueness and prevents possible duplications of entries. (commit: d9b70bd)
Updated the ChestShopSign's accessor methods in RemoveAccessor.java and AddAccessor.java to use UUIDs instead of player names for better tracking and handling of user identities. The changes include the addition of UUID import, new error messages in Configuration/Messages.java, and modification in getAccessors method in ChestShopSign.java. (commit: 203fef8)
Integrated a check in the AddAccessor.java file to prevent the owner of a shop from being added as an accessor, returning an error message defined in the Messages.java file in such instances. This ensures the owner's privileges are not unintentionally downgraded or altered. (commit: b4b55b7)
This update introduces a new feature that displays additional information about the shop owner when they interact with their shop. Included in this update is also the display of a list of accessors to aid user interaction. To support this new feature, relevant messages have been added to the Messages.java file. (commit: 255ddc3)
The variable name in the loop has been changed from 'string' to 'accessorUUID' in PlayerInteract.java for better clarity. Alongside this renaming, the code in ChestShopSign.java has been updated to return an empty HashSet when no accessor data exists to avoid any potential errors or misinterpretations. (commit: 2e84c34)
The getUUIDForFullName method was added in the NameManager class to retrieve the UUID for the given full name. The function retrieves the corresponding UUID from the fullNamesToUUID map after converting the provided name to lowercase. (commit: 2a0dbea)
The validation method "isValid" in the ChestShopSign class has been replaced with "isLegacyValid". Changes were made across multiple files where this method is used. Additionally, import sections were tidied in several classes, grouping related imports together. (commit: 65cb039)
The validation check "isLegacyValid" in the ChestShopSign class has been replaced with "isChestShop". Changes were done in the ChestShop, RestrictedSign, and ChestShopSign classes where this method was called. A new validation function "isChestShop" was also added to check if a block is a ChestShop sign. (commit: 21c6774)
Removed ItemChecker class and restructured PlayerInteract class to utilize ChestShopMetaData for improved efficiency and simplicity in code management. The approach minimizes direct sign line manipulation in favor of pre-computed metadata, thereby reducing error possibilities and improving code legibility. (commit: 0dc6dc8)
The ItemChecker class has been removed and the PlayerInteract class has been reframed to use ChestShopMetaData. This enhances code efficiency and simplicity. Direct sign line manipulation has been minimized in favor of using pre-calculated metadata, thus reducing potential errors and improving code readability. (commit: 6979486)
Enhance sign manipulation by using ChestShopMetaData
The PlayerInteract class has been updated to use ChestShopMetaData instead of direct sign line manipulation. This has not only improved code efficiency and readability, but also reduced the possibility of errors. Besides, accessors management has been added in Sign class to better manage access control. (commit: 350a3be)
Remove commands SetAmount, SetItem, SetPrice, and refactor isChestShop method
Removed SetAmount, SetItem and SetPrice commands for ChestShop giant cleanup. Also replaced ChestShopSign.isLegacyValid method with isChestShop for more precise sign checking in the uBlock, RemoveAccessor, and AddAccessor classes. These improvements aim to streamline the codebase and minimize future debugging efforts. (commit: fe6e05e)
Replaced the isLegacyValid method with isChestShop in various classes for more accurate sign validation in the ChestShop plugin. This enhances the clarity of the code, allowing for easier understanding and debugging in the future. (commit: a2c24b6)
Refactored the sign creation process and added logic in ChestShop listener to handle autofill items. Extracted methods to check sign validity into ChestShopSign class for better encapsulation. Also, moved the price parsing logic to use methods from ChestShopSign. This change improves code readability and the robustness of the sign creation process. (commit: f99ceb3)
Refactor sign creation process and add autofill items logic
Updated the sign creation process in ChestShop listener to include validation of autofill items via a new getItemStack method. Also, refactored the ChestShopSign class to handle the encapsulation of sign validity checks, improving code readability and robustness. (commit: ec4563b)
Refactor sign validation and creation in ChestShop
Updated the sign creation process to handle item autofill validation directly. Included changes to the ChestShopSign class to centralize sign validity checks, therefore enhancing code readability and consistency. Various adjustments throughout the codebase were made to support these changes. (commit: c4fb1c2)
Update itemStack to read from correct event line in SignCreate
This update fixes a bug where the itemStack was incorrectly read from event.getLine(4) instead of event.getLine(3) in the SignCreate class. This change ensures the correct line from the event is read, avoiding potential errors in the sign creation process. The PriceCheckerTest has also been removed reflecting the current state of the codebase. (commit: a241a18)
Refactor check method for admin shop in PreShopCreation events
The commit replaces `isAdminShop(event.getSign())` with `isAdminshopLine(event.getOwnerName())` in PreShopCreation events across TerrainChecker, ChestChecker, and MoneyChecker files. This change enhances the checking mechanism for admin shops, thus improving the shop creation process. (commit: a7944fd)
Make ItemStack final in PreShopCreationEvent class
The change includes making `itemStack` final in the `PreShopCreationEvent` class. It ensures that the item details remain constant and secure during the process of shop creation. This improves data integrity and allows consistent information to be shared with the player during sign creation. (commit: 99d832c)
Remove invalid price error message in pre-shop creation
This commit removes the error message indicating an invalid price from the pre-shop creation process. This isn't needed anymore, as price validation has now been handled elsewhere, reducing redundancy of error messages. (commit: ebb478d)
Change quantity line index in pre-shop creation event
This commit changes the signLines index from 2 to 1 in the getQuantityLine method within the PreShopCreationEvent file. This modification is required to ensure the appropriate line is referenced, ensuring correct behavior of pre-shop creation events. (commit: a897576)
The getNameFor method in NameManager.java file has been updated to return the player's display name instead of their UUID. Additionally, MaterialUtil library has been imported in PreShopCreationEvent class to fetch the name of the item type for the given ItemStack, which is then set as the third line of signLines. (commit: 6bb5ca8)
ItemChecker class has been added for the pre-shop creation process. It validates the ItemStack, and sets the name of the item type as the third line of signLines in PreShopCreationEvent. Unused import in PreShopCreationEvent has been removed. (commit: 5e125ed)
The ChestShopSign class has been updated to correctly persist sign data. An update method call has been added after setting persistent data, to ensure changes are saved and persisted within the server. (commit: c0d7234)
The serialization and deserialization methods in the ChestShopMetaData class have been modified. UUID fields are now saved and reloaded as strings rather than as UUID objects to ensure correct data persistence. Alongside, necessary changes were addressed during the transformation to and from a string to UUID. (commit: 7341098)
Add null validation for getItemStack in PreShopCreationEvent
Inserted a null validation for the getItemStack method in PreShopCreationEvent.java. This modification ensures that the getItemStack method returns null when the itemStack object is null, avoiding attempts to clone a nonexistent object which can lead to null pointer exceptions. (commit: a439c2d)
Remove unused import and simplify conditional in NameChecker
Removed extra import 'Permission' and simplified a conditional statement in the NameChecker class. This refactoring streamlines the logic for setting the name during PreShopCreationEvent, making the code more straightforward without changing functionality. (commit: 76053f4)
Fix interaction handling and price-line index for ChestShop
The conditions for ChestShop interactions have been altered to handle non-ChestShop signs properly. In addition, the index used to reference the price-line for sign creation in the ChestShop was corrected, to ensure that the correct price is fetched and applied. (commit: d048c8a)
The 'createShopMetaData', 'createChestShop', and 'createAdminChestShop' methods in 'SignCreate' class have been refactored. The unnecessary 'sign' parameter has been removed from these methods, streamlining the code and fixing potential issues with incorrect sign references. (commit: 05c2450)
The ItemChecker class now includes functionality to handle item metadata during PreShopCreation. It adds a check for itemStack's metadata, strips any color from displayName if it exists or adds italics to itemName if the metadata is unique. This ensures correct preprocessing of items with metadata. (commit: 41e733a)
The changes in the codebase remove unused imports and commenting out unused code in ItemInfo command class. This process helps in maintaining the code clean and easy to read, improving the maintainability of the code. (commit: df8ae51)
The code changes include additions which allow the ItemInfo command class to send chat messages to the sender. It generates a text component and attaches it to the sender using spigot's sendMessage method, enhancing user interaction. (commit: e6c9d62)
The code changes include additions which allow the ItemInfo command class to send chat messages to the sender. It generates a text component and attaches it to the sender using spigot's sendMessage method, enhancing user interaction. (commit: 157b53a)
Refactor PlayerInteract class and optimize sign check
This commit optimizes the sign checking in the PlayerInteract class. Instead of multiple checks using different methods, the logic has been centralized to one conditional statement. This helps in reducing redundancies and ensuring code efficiency. (commit: 29d49b9)
Refactor ItemChecker class and simplify sign item check
This commit simplifies the item checking process in the the PreShopCreation event in ItemChecker class. It extracts the item checking logic into a separate method and uses the result for setting the item outcome, making the code more readable and maintainable. (commit: 4638cc8)
Refactor and simplify item checking in PreShopCreation event
In this commit, the item checking process inside the PreShopCreation event was refactored and simplified for better readability and maintainability. The item checking logic was extracted into separate methods, making the code more streamlined and easier to understand. (commit: a76a0ad)
This commit contains improvements to the way the ChestShop plugin handles User ID (UUID) during the shop creation process. The getUUIDFor function was tweaked for admin shop identification. A security check was also added to prevent users from creating a shop on behalf of other users unless they have admin permission. The input processing in PreShopCreation event has also been refined. (commit: 4ee899e)
This commit refactors how sign-related data is handled in the ChestShopSign class. It removes the use of PersistentDataContainer and YamlConfiguration for managing sign-related data, instead directly updating the sign's data in methods. It also introduces usage of ItemChecker to get item names on the sign. (commit: fd24557)
Enhance ChestShopSign logging and refactor some code
This commit improves the logging in the ChestShopSign's conversion method for better traceability. It now logs information including owner UUID, their full name, and sign coordinates. The way sign-related data is managed has been refactored for a cleaner, more readable code. The PersistentDataContainer check condition has also been corrected. (commit: 5aecc9e)
This commit updates the NameChecker in the ChestShopListener, ensuring that when a blank owner name is provided, it defaults to the player's unique ID. This change facilitates smoother store creation for players and improves data consistency. (commit: 8857089)
This commit refactors the addAccessor command logic in the ChestShop application. It now compares the newAccessor to the actual owner of the chest shop instead of the player's ID. This change ensures more accurate assignment of access permissions. (commit: 3d7c8c6)
Refactor message when player not found in ChestShop
This commit changes the error message output when the player is not found in the RemoveAccessor and AddAccessor commands in the ChestShop application. Instead of "UNKNOWN_PLAYER", the error message now correctly displays as "PLAYER_NOT_FOUND", providing clearer indication of the issue to the user. (commit: 1ecf383)
This commit introduces a new getItemStack method in ChestShopSign.java. This method retrieves the ItemStack of the given Sign. If the Sign does not represent a ChestShop, it returns null. This is useful for checking the item details stored in a ChestShop. (commit: bb9221a)
The code modifications limit the length of the shop owner's name and the item name by using a substring operation in NameChecker.java and ItemChecker.java. The aim is to enhance compatibility and prevent potential display or processing issues due to excessively long names. (commit: 88b4015)
This commit introduces a new class, PreShopCreationItemDisplayNameEvent, which will handle the display name of the items during shop creation. Accompanying changes have also been made to the ItemChecker class to utilize this new event and ensure proper handling of item display names, improving the functionality of the shop creation process. (commit: 512ac36)
Updated MaterialUtil and ItemChecker classes for improved item name retrieval. Removed unused "getName" method in MaterialUtil and replaced item name retrieval in ItemChecker with the new "getSignMaterialName" method. This optimizes item name fetching during shop creation. (commit: cffeb9d)
Add documentation for PreShopCreationItemDisplayNameEvent
Added Javadoc comments for the PreShopCreationItemDisplayNameEvent class. This class represents an event that is fired before the display name of an item in a shop is created. The final value of displayName will be displayed on the sign of the newly created shop. (commit: 5fbe2f0)
Implement item display name shortener functionality
Introduce the ability to shorten item display names in the ChestShop plugin. New classes and methods provide this functionality, especially when the display name is too long for certain containers. Detailed priority mappings are added for multiple common strings along with relevant tests. Furthermore, additional utility methods have been added for string manipulation and whitespace handling. (commit: 97a71bc)
Refactor sign display and logger update in ChestShop
Reorganized the flow of data in ChestShopSign class by separating sign display update and logging process. The method `updateSignDisplay` has been introduced to handle sign data updates, improving the modularity of the code and increasing readability. The logger now only logs when necessary, reducing the frequency of logger calls. (commit: 4073ecf)
Modify item name shortening to be case-insensitive
This update modifies the item name shortening feature in ChestShop by switching the keyed names to lowercase first, ensuring case-insensitive comparison. Test cases for the new functionality were also added. Furthermore, a safety measure was implemented where `substring` will not exceed `cutdown.length`, preventing unforeseen StringIndexOutOfBoundsException. (commit: 2a893d6)
Refine item name shortening and related test cases
This commit improves the item name shortening operation to be case-insensitive by converting keyed names to lowercase first. It also introduces new test cases to verify the updated functionality. Additionally, it implements a safeguard to ensure the 'substring' function does not exceed the 'cutdown.length', thereby avoiding potential StringIndexOutOfBoundsException issues. (commit: c028bec)
The commit modifies test strings in different methods of the ItemCheckerTest class. The new test strings seem to emphasize the concept of tests, aimed to ensure that the shortenDisplayName method works as expected for different input cases. (commit: 032ce1c)
Refactor item name shortening and sign update process
This commit refines the item name shortening process in 'ChestShopItemDisplayNameShortener' by removing unnecessary mappings and adjusting others. It also optimizes the ChestShopSign update process by avoiding unnecessary sign display updates and checking once if the object is a ChestShop sign. (commit: 0942068)
This commit changes the accessor related messages in the Messages.java file from final to non-final. By doing this, the system becomes flexible to change these messages at runtime if needed for localization or other purposes. (commit: 73a19a9)
Remove unnecessary import and refactor item name handling
This change removes the unused import, MaterialUtil, from ItemChecker.java, and refactors how item names are determined. Instead of using MaterialUtil.getSignMaterialName, we now employ StringUtil.capitalizeFirstLetter to get the item name, which simplifies the code and reduces dependencies. (commit: 690ff33)
Cleaned up and streamlined the arrangement of import declarations in several Java classes. This adjustment improves the readability of code and adheres to good software design principles by grouping together related classes and removing unnecessary blank lines. (commit: 2461e51)
Updated to provide better organization of import statements
Reorganized and consolidated import declarations in multiple Java files for improved code clarity and readability. This update adheres to software design best practices by grouping related classes closer together, enhancing comprehensibility of the code structure. (commit: 296e741)
Refactor import statements across multiple classes
A sweeping change has been made to the import statements of many classes, hereby enhancing readability and understandability in the codebase. This involves reorganizing and consolidating the import statements so as to group similar function classes together, providing for an efficient understanding of code dependencies. (commit: 238f8b5)
Three new command classes (SetAmount, SetPrice, SetItem) have been added to the ChestShop java module. These commands allow players to modify key parameters (i.e., the amount, price, and item of a chest shop) directly, improving ongoing shop management capabilities. These changes have also been integrated into the ChestShop.java Executor configuration. (commit: 6e2e0f0)
Refine pattern matching and add logging in ChestShop app
The regular expression pattern used for matching shop sign text in the ChestShopSign.java file has been updated to allow new characters. In addition, a new logging entry has been added, outputting warning messages whenever a set of lines does not match the expected sign pattern. This will help in debugging and identifying any potential issues with the sign creation process. (commit: 00bdbb0)
Moved the instantiation of the Sign object to an earlier point in SignCreate.java, ensuring it is only created once. Furthermore, redundant code that manually updated sign lines in SetAmount.java, SetPrice.java, and SetItem.java was removed, to simplify and clean the overall codebase. (commit: d9c4cc4)
Refactor PlayerInteract for better ChestShop usage
This commit includes changes to the 'PlayerInteract.java' code to streamline its functioning with 'ChestShop'. The revisions largely revolve around replacing ChestShopSign methods with equivalent methods in ChestShopMetadata, in order to provide a neater and more direct access to the shop's information. This revamped approach results in more concise, readable code and directly enhances the performance by reducing unnecessary method calls. (commit: e6fdfa3)
Update code to use ChestShopMetaData for shop information management
In this commit, methods from the ChestShopSign class were replaced with equivalent methods in the new ChestShopMetaData class across multiple files. This centralized approach allows for a more efficient and direct access to the shop's data, enhancing code readability, and reducing redundant method calls for improved performance. (commit: 9642e38)
Remove author tags in RemoveAccessor and AddAccessor classes
In this commit, the author tags in both the RemoveAccessor and AddAccessor classes are being removed. These comments did not directly contribute to the functionality of the code, and thus were deemed unnecessary and removed for clarity. (commit: 5f851a3)
Refactor null check for itemStack in PreShopCreationEvent class
The conditional statement to check if itemStack is null in the PreShopCreationEvent class has been refactored. The outcome update statement is now enclosed within a block, improving the readability and clarity of the if-statement in the code. (commit: 4ce2866)
ChestShopSign metadata handling has been improved by encapsulating the sign update within the validity check. The method for updating the sign display has also been restructured to firstly fetch the relevant ChestShopMetaData before proceeding, providing a more efficient processing order. (commit: a9e736f)
Improve the error checking mechanism for the `ChestShopSign` metadata handling by introducing a validation layer. This layer will delay the metadata saving task, allowing the system to verify its correctness before execution, hence improving data integrity. The async task is scheduled with a one tick delay to ensure a smoother operation even under potential exceptions. (commit: 2d073f7)
Revised the conditional comparison logic in the `PriorityItemDisplayNameShortener` class from equality check to containment check. This change enhances flexibility in checking and handling item names, allowing names in the 'from' section to match more widely with those in the 'to' section, reducing the chance of mismatch errors. (commit: 9fd2c5b)
Modified the ItemInfo class to enhance the way items names are displayed, including full name and sign item name. Added a 'getDisplayName' method in the ItemChecker class to increase versatility and support further code development. (commit: 2dcccc0)