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 PlayerESP teammates marking #946

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mt1006
Copy link

@mt1006 mt1006 commented Feb 6, 2024

Description

Marking potential teammates with light blue PlayerESP line color, based on the color of dyed leather armor. If both players have at least one leather armor piece with the same color (excluding not dyed), the player is marked as a teammate.
It also adds checkbox to disable it.

Testing

Tested on a local server and on the bedwars match.

References

Example

Copy link

coderabbitai bot commented Feb 6, 2024

Walkthrough

Walkthrough

The update introduces a feature that allows players to visually distinguish their teammates in-game through the use of dyed armor pieces. This is achieved by marking teammates with light blue colored armor, facilitated by a new checkbox setting for enabling or disabling this functionality. The change enhances team coordination by making it easier to identify allies during gameplay.

Changes

File Path Change Summary
.../hacks/PlayerEspHack.java Added functionality to mark teammates with light blue dyed armor pieces using a markTeammates checkbox setting.

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:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@CLAassistant
Copy link

CLAassistant commented Feb 6, 2024

CLA assistant check
All committers have signed the CLA.

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.

Review Status

Actionable comments generated: 5

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 57cdc85 and 9ea68f0.
Files selected for processing (1)
  • src/main/java/net/wurstclient/hacks/PlayerEspHack.java (7 hunks)

Comment on lines +119 to +129
armorColors.clear();
if(!markTeammates.isChecked())
return;

for(ItemStack s : player.getArmorItems())
{
Item item = s.getItem();
if(item instanceof DyeableArmorItem)
armorColors.add(((DyeableArmorItem)item).getColor(s));
}
armorColors.remove(DyeableArmorItem.DEFAULT_COLOR);
Copy link

Choose a reason for hiding this comment

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

The logic for populating armorColors does not account for the possibility of a player not wearing any armor. This could lead to unnecessary execution of the loop. Consider adding a check to skip this process if the player is not wearing any armor.

Comment on lines +187 to +188
else if(isInTeam(e))
RenderSystem.setShaderColor(0.4F, 0.7F, 1, 0.5F);
Copy link

Choose a reason for hiding this comment

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

The color values used for marking teammates (0.4F, 0.7F, 1) are hardcoded. For better maintainability and readability, define these as static final variables with descriptive names.

Comment on lines +231 to +235
}else if(isInTeam(e))
{
r = 0.4F;
g = 0.7F;
b = 1;
Copy link

Choose a reason for hiding this comment

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

Similar to the previous comment, the color values used here are also hardcoded. Apply the same recommendation: define these as static final variables for improved code clarity and maintainability.

Comment on lines +256 to +270
private boolean isInTeam(PlayerEntity otherPlayer)
{
if(armorColors.isEmpty() || !markTeammates.isChecked())
return false;

for(ItemStack s : otherPlayer.getArmorItems())
{
Item item = s.getItem();
if(item instanceof DyeableArmorItem
&& armorColors.contains(((DyeableArmorItem)item).getColor(s)))
return true;
}

return false;
}
Copy link

Choose a reason for hiding this comment

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

The isInTeam method performs its intended function but lacks efficiency in handling armor items. Consider streamlining the loop with Java Streams to improve readability and potentially enhance performance.

private boolean isInTeam(PlayerEntity otherPlayer) {
    if(armorColors.isEmpty() || !markTeammates.isChecked())
        return false;

    return otherPlayer.getArmorItems().stream()
        .map(ItemStack::getItem)
        .filter(DyeableArmorItem.class::isInstance)
        .anyMatch(item -> armorColors.contains(((DyeableArmorItem)item).getColor(item)));
}

@TejasLamba2006
Copy link
Contributor

You can also add a new hack named TeamAssist which will add teammates as friends automatically and remove them after they are not in the world

@mt1006
Copy link
Author

mt1006 commented Feb 8, 2024

This is also a solution, but at at least for me, I would prefer to see a difference between manually added friends and teammates. I think a better solution would be to add a global list of teammates, separated from the friend list. It could have options to disable it or change the way teammates are predicted (e.g. based on the tab list color).
The setting like TeamAssist could be then used to filter them out from non-visual hacks like auras, because making them "friends" by default could be dangerous on for example survival servers, where enemy can put a leather armor with the same color.
As for this PR, it's rather a temporal solution.

Copy link

github-actions bot commented Apr 9, 2024

This pull request has been open for a while with no recent activity. If you're still working on this or waiting for a review, please add a comment or commit within the next 7 days to keep it open. Otherwise, the pull request will be automatically closed to free up time for other tasks.

Pull requests should be closed if:

  • They have been superseded by another pull request
  • They are out of scope or don't align with the project
  • They have become obsolete due to other changes
  • They have bugs or conflicts that won't be resolved

@mt1006
Copy link
Author

mt1006 commented Apr 11, 2024

4

Copy link

This pull request has been open for a while with no recent activity. If you're still working on this or waiting for a review, please add a comment or commit within the next 7 days to keep it open. Otherwise, the pull request will be automatically closed to free up time for other tasks.

Pull requests should be closed if:

  • They have been superseded by another pull request
  • They are out of scope or don't align with the project
  • They have become obsolete due to other changes
  • They have bugs or conflicts that won't be resolved

@mt1006
Copy link
Author

mt1006 commented Jun 16, 2024

Do I have to make these changes suggested by coderabbit?

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.

3 participants