-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
AutoSteal Whitelist #914
AutoSteal Whitelist #914
Conversation
Warning Rate Limit Exceeded@mdenials has exceeded the limit for the number of files or commits that can be reviewed per hour. Please wait 10 minutes and 53 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the @coderabbitai review command. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThe changes involve enhancing an Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ? TipsChat with CodeRabbit Bot (
|
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.
Review Status
Actionable comments generated: 3
Configuration used: CodeRabbit UI
Files selected for processing (3)
- src/main/java/net/wurstclient/hacks/AutoStealHack.java (1 hunks)
- src/main/java/net/wurstclient/mixin/GenericContainerScreenMixin.java (2 hunks)
- src/main/java/net/wurstclient/mixin/ShulkerBoxScreenMixin.java (2 hunks)
Additional comments: 8
src/main/java/net/wurstclient/hacks/AutoStealHack.java (2)
61-74: The new methods
areFilterEnabled
andgetItemList
are implemented correctly and follow Java best practices for getter methods.50-52: The addition of the new settings to the
addSetting
method is correct and ensures that they are registered and usable within the hack.src/main/java/net/wurstclient/mixin/GenericContainerScreenMixin.java (1)
- 105-113: The logic for checking the whitelist appears to be correct, but it's important to ensure that the
Registries.ITEM.getId(item).toString()
method reliably converts theItem
to a string that matches the format used in theItemListSetting
. If there's any discrepancy in the format, the whitelist check might fail to recognize items correctly.Verification successful
Let's generate a new script to find the file where
ItemListSetting
is defined or used and to search for any usage ofRegistries.ITEM.getId(item).toString()
to infer the format of the string it returns.
Based on the search results, the
ItemListSetting
class uses theRegistries.ITEM.getId(item).toString()
method to handle item names as strings, which indicates that the format of the string representation of items used in the whitelist is consistent with the format returned by this method. Therefore, the whitelist check in theGenericContainerScreenMixin.java
file should work as intended, recognizing items correctly based on the user's configuration.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the string representation of items used in the whitelist matches the format returned by Registries.ITEM.getId(item).toString() # This can be done by checking the format of strings stored in the ItemListSetting and comparing them with the output of the mentioned method. # Pseudo-command for demonstration purposes: # Check the format of strings in the ItemListSetting (assuming the setting is stored in a file or can be accessed via a command) cat path_to_item_list_setting_storage | grep -o 'expected_item_format_regex' # Check the format of strings returned by Registries.ITEM.getId(item).toString() (assuming there's a way to invoke this method from the command line) # This would likely require a Java command or script that can access the game's or mod's code to run the method and output the format. java -jar path_to_minecraft_or_mod_jar 'Registries.ITEM.getId(item).toString()' | grep -o 'expected_item_format_regex'Length of output: 333
Script:
#!/bin/bash # Find the file where ItemListSetting is defined or used fd 'ItemListSetting' --exec rg 'ItemListSetting' {} # Search for any usage or comments related to Registries.ITEM.getId(item).toString() to infer the format of the string it returns rg 'Registries.ITEM.getId\(.+\).toString\(\)'Length of output: 1314
src/main/java/net/wurstclient/mixin/ShulkerBoxScreenMixin.java (5)
22-25: The imports for
Item
,ItemStack
,Registries
, andItemListSetting
have been correctly added and are used within theshiftClickSlots
method.96-105: The new logic within the
shiftClickSlots
method correctly handles the whitelist feature. It checks if the item is on the whitelist and if the filter is enabled before deciding to skip the item.96-99: Variables
stack
,item
, anditemName
are declared and used appropriately within the loop to handle the item's information and check against the whitelist.104-105: The conditional check to determine if an item should be ignored based on the whitelist is correctly implemented and follows the logic described in the PR's objective.
93-108: The changes made to the
shiftClickSlots
method align with the PR's objective of introducing a whitelist feature for the AutoSteal hack, allowing users to specify items that should not be automatically stolen.
for(int i = from; i < to; i++) | ||
{ | ||
Slot slot = handler.slots.get(i); | ||
ItemStack stack = slot.getStack(); | ||
Item item = stack.getItem(); | ||
String itemName = Registries.ITEM.getId(item).toString(); | ||
|
||
if(slot.getStack().isEmpty()) | ||
continue; | ||
|
||
if(!autoSteal.getItemList().contains(itemName) && autoSteal.areFilterEnabled()) | ||
continue; | ||
|
||
waitForDelay(); | ||
if(this.mode != mode || client.currentScreen == null) |
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.
The new whitelist logic in shiftClickSlots
method is implemented correctly according to the PR's objective. However, consider adding more robust error handling in the runInThread
method to handle exceptions that may occur during the execution of the shiftClickSlots
method.
private void runInThread(Runnable r)
{
new Thread(() -> {
try
{
r.run();
}
catch(Exception e)
{
// Consider implementing a more robust error handling strategy here.
// For example, logging the error to a file or notifying the user.
e.printStackTrace();
}
}).start();
}
src/main/java/net/wurstclient/mixin/GenericContainerScreenMixin.java
Outdated
Show resolved
Hide resolved
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- src/main/java/net/wurstclient/mixin/GenericContainerScreenMixin.java (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/main/java/net/wurstclient/mixin/GenericContainerScreenMixin.java
Added a whitelist for autosteal