-
-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 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
47 changes: 47 additions & 0 deletions
47
src/main/java/net/wurstclient/settings/filters/FilterTeammatesSetting.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package net.wurstclient.settings.filters; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.text.TextColor; | ||
import net.wurstclient.WurstClient; | ||
|
||
public final class FilterTeammatesSetting extends EntityFilterCheckbox | ||
{ | ||
public FilterTeammatesSetting(String description, boolean checked) | ||
{ | ||
super("Filter teammates", description, checked); | ||
} | ||
|
||
@Override | ||
public boolean test(Entity e) | ||
{ | ||
Text theirName = e.getDisplayName(); | ||
if(theirName == null) | ||
return false; | ||
TextColor theirColor = theirName.getStyle().getColor(); | ||
if(theirColor == null) | ||
return false; | ||
|
||
assert WurstClient.MC.player != null; | ||
Text myName = WurstClient.MC.player.getDisplayName(); | ||
if(myName == null) | ||
return false; | ||
TextColor myColor = myName.getStyle().getColor(); | ||
if(myColor == null) | ||
return false; | ||
|
||
return !theirColor.equals(myColor); | ||
} | ||
|
||
public static FilterTeammatesSetting genericCombat(boolean checked) | ||
{ | ||
return new FilterTeammatesSetting( | ||
"Won't attack players with the same name tag color.", checked); | ||
} | ||
|
||
public static FilterTeammatesSetting genericVision(boolean checked) | ||
{ | ||
return new FilterTeammatesSetting( | ||
"Won't show players with the same name tag color.", checked); | ||
} | ||
} |