Skip to content
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

Add Slider to AntiAFK for Custom Movement Increment Setting #982

Conversation

Developer78-sgyuijhgygwtdwgyhutre45r5t
Copy link
Contributor

@Developer78-sgyuijhgygwtdwgyhutre45r5t Developer78-sgyuijhgygwtdwgyhutre45r5t commented Apr 14, 2024

Description

Adds a slider option to the AntiAFK feature, allowing users to select the duration the client waits before moving the player, while preserving the original random functionality by default.

Testing

Tested on singleplayer and in multiplayer servers.

References

See #280

Summary by CodeRabbit

  • New Features
    • Added customizable settings for Anti-AFK timing using sliders, allowing users to set specific intervals between movements.
  • Enhancements
    • Improved the Anti-AFK feature's timing logic for more dynamic and user-responsive behavior.

@CLAassistant
Copy link

CLAassistant commented Apr 14, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

coderabbitai bot commented Apr 14, 2024

Walkthrough

Walkthrough

The modifications to the AntiAfkHack class enhance its functionality by introducing a dynamic movement timer, controlled via new slider settings. These changes allow users to customize the time intervals between movements, thereby improving the anti-AFK mechanism's adaptability and effectiveness. The introduction of methods like updateMovementValue and setTimer() centralizes the logic for timing adjustments, making the code more modular and maintainable.

Changes

File Path Summary of Changes
.../hacks/AntiAfkHack.java Introduced SliderSetting for dynamic time control between movements, added updateMovementValue and setTimer() methods for better timing management, and updated data types for timers.

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 your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

Note: Auto-reply has been disabled for this repository by the repository owner. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

src/main/java/net/wurstclient/hacks/AntiAfkHack.java Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

src/main/java/net/wurstclient/hacks/AntiAfkHack.java Outdated Show resolved Hide resolved
src/main/java/net/wurstclient/hacks/AntiAfkHack.java Outdated Show resolved Hide resolved
src/main/java/net/wurstclient/hacks/AntiAfkHack.java Outdated Show resolved Hide resolved
src/main/java/net/wurstclient/hacks/AntiAfkHack.java Outdated Show resolved Hide resolved
src/main/java/net/wurstclient/hacks/AntiAfkHack.java Outdated Show resolved Hide resolved
src/main/java/net/wurstclient/hacks/AntiAfkHack.java Outdated Show resolved Hide resolved
@Alexander01998 Alexander01998 linked an issue Apr 14, 2024 that may be closed by this pull request
@Alexander01998 Alexander01998 added type:enhancement New feature or request area:settings Improves the settings of existing features. category:other labels Apr 14, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

src/main/java/net/wurstclient/hacks/AntiAfkHack.java Outdated Show resolved Hide resolved
@Developer78-sgyuijhgygwtdwgyhutre45r5t
Copy link
Contributor Author

Hello @Alexander01998, Thanks for taking the time to review my pull request. I have made the requested changes. If there are any further changes you would like me to make, feel free to let me know.

@Alexander01998 Alexander01998 added this to the v7.42 milestone Apr 17, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

src/main/java/net/wurstclient/hacks/AntiAfkHack.java Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0b7dde2 and 271fb1c.
Files selected for processing (1)
  • src/main/java/net/wurstclient/hacks/AntiAfkHack.java (5 hunks)
Additional comments not posted (4)
src/main/java/net/wurstclient/hacks/AntiAfkHack.java (4)

39-48: The implementation of SliderSetting for waitTime and waitTimeRand is well done. The labels and suffixes are clear and appropriate. However, ensure that the suffixes and prefixes are in lowercase for consistency, as per previous discussions.


Line range hint 107-165: The onUpdate method handles the AI pathfinding and timer decrement effectively. The separation of logic based on whether AI is used or not is clear and maintains the flow of the method. Ensure that the timer logic is thoroughly tested in various scenarios to confirm its robustness.

Verification successful

The verification process has revealed that the timer variable in the onUpdate method of the AntiAfkHack.java file is indeed used for decrementing and checking conditions as described in the review comment. The code snippets provided from the search results show that the timer is initialized, decremented, and checked within conditional statements, aligning with the expected behavior for managing AI pathfinding and timer-based actions.

However, there was no output from searching for test files related to AntiAfkHack, indicating that there might not be any specific unit tests covering this functionality in the repository. This absence of tests could be a concern for verifying the robustness of the timer logic under various scenarios, as initially intended.

Given the findings:

  • The timer logic's implementation in the code aligns with the description in the review comment.
  • The lack of test files suggests a potential gap in automated testing for this functionality.

Recommendation:

  • It would be beneficial to implement unit tests to ensure the timer logic works correctly under various conditions and scenarios. This would help in maintaining robustness and reliability of the feature.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the robustness of timer logic in various scenarios.

# Test: Run simulations with different `waitTime` and `waitTimeRand` settings.
# Expect: The timer should correctly count down and trigger movements as expected.
echo "Simulate different scenarios and check timer functionality."

Length of output: 128



Script:

#!/bin/bash
# Description: Check the timer decrement and action triggering in the onUpdate method.

# Using rg to find the usage of the timer variable in the onUpdate method.
rg "timer" src/main/java/net/wurstclient/hacks/AntiAfkHack.java

# Additional check to see if there are any test files related to AntiAfkHack that might include timer tests.
rg "AntiAfkHack" --files-with-matches test/

Length of output: 352


Line range hint 234-255: The RandomPathFinder class extends PathFinder and customizes it for the AntiAFK functionality. The constructor modifications and the overridden formatPath method are appropriate for the intended use. Ensure that the pathfinding logic is compatible with the new randomization features.


Line range hint 31-255: Overall, the integration of the new SliderSetting instances and the setTimer method into the AntiAfkHack class is well executed. The changes are consistent with the objectives of providing customizable AntiAFK functionality. Continue to monitor user feedback and performance impacts as these features are used in various environments.

@Alexander01998 Alexander01998 added the status:merged This pull request has been merged, even if GitHub says otherwise. label May 7, 2024
@Alexander01998 Alexander01998 merged commit bed243b into Wurst-Imperium:master May 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:settings Improves the settings of existing features. category:other status:merged This pull request has been merged, even if GitHub says otherwise. type:enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AFK timer
4 participants