Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 68d155e

Browse files
committed
Add option to hide tip messages
- replace a few *.Instance.* calls with getters
1 parent 5a76dee commit 68d155e

File tree

12 files changed

+58
-31
lines changed

12 files changed

+58
-31
lines changed

src/main/java/io/github/axolotlclient/AxolotlClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ public static void addBadge(Entity entity, MatrixStack matrices){
194194
assert MinecraftClient.getInstance().player != null;
195195
int x = -(MinecraftClient.getInstance().textRenderer.getWidth(
196196
entity.getUuid() == MinecraftClient.getInstance().player.getUuid()?
197-
(NickHider.Instance.hideOwnName.get() ? NickHider.Instance.hiddenNameSelf.get(): Team.decorateName(entity.getScoreboardTeam(), entity.getName()).getString()):
198-
(NickHider.Instance.hideOtherNames.get() ? NickHider.Instance.hiddenNameOthers.get(): Team.decorateName(entity.getScoreboardTeam(), entity.getName()).getString())
197+
(NickHider.getInstance().hideOwnName.get() ? NickHider.getInstance().hiddenNameSelf.get(): Team.decorateName(entity.getScoreboardTeam(), entity.getName()).getString()):
198+
(NickHider.getInstance().hideOtherNames.get() ? NickHider.getInstance().hiddenNameOthers.get(): Team.decorateName(entity.getScoreboardTeam(), entity.getName()).getString())
199199
)/2 + (AxolotlClient.CONFIG.customBadge.get() ? MinecraftClient.getInstance().textRenderer.getWidth(" "+ Formatting.strip(AxolotlClient.CONFIG.badgeText.get())): 10));
200200

201201
RenderSystem.setShaderColor(1, 1, 1, 1);

src/main/java/io/github/axolotlclient/mixin/ChatHudMixin.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import io.github.axolotlclient.modules.hypixel.autoboop.AutoBoop;
2626
import io.github.axolotlclient.modules.hypixel.autogg.AutoGG;
27+
import io.github.axolotlclient.modules.hypixel.autotip.AutoTip;
2728
import io.github.axolotlclient.modules.hypixel.nickhider.NickHider;
2829
import net.minecraft.client.gui.hud.ChatHud;
2930
import net.minecraft.client.gui.hud.ChatMessageTag;
@@ -38,16 +39,20 @@
3839
@Mixin(ChatHud.class)
3940
public abstract class ChatHudMixin {
4041

41-
@Inject(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/chat/MessageSignature;Lnet/minecraft/client/gui/hud/ChatMessageTag;)V", at = @At("HEAD"))
42+
@Inject(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/chat/MessageSignature;Lnet/minecraft/client/gui/hud/ChatMessageTag;)V", at = @At("HEAD"), cancellable = true)
4243
public void autoThings(Text message, MessageSignature signature, ChatMessageTag tag, CallbackInfo ci){
43-
AutoGG.Instance.onMessage(message);
44-
AutoBoop.Instance.onMessage(message);
44+
AutoGG.getInstance().onMessage(message);
45+
AutoBoop.getInstance().onMessage(message);
46+
47+
if(AutoTip.getInstance().onChatMessage(message)){
48+
ci.cancel();
49+
}
4550
}
4651

4752
@ModifyArg(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/chat/MessageSignature;Lnet/minecraft/client/gui/hud/ChatMessageTag;)V",
4853
at = @At(value = "INVOKE",
4954
target = "Lnet/minecraft/client/gui/hud/ChatHud;addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/chat/MessageSignature;ILnet/minecraft/client/gui/hud/ChatMessageTag;Z)V"), index = 0)
5055
public Text editChat(Text message) {
51-
return NickHider.Instance.editMessage(message);
56+
return NickHider.getInstance().editMessage(message);
5257
}
5358
}

src/main/java/io/github/axolotlclient/mixin/PlayerEntityRendererMixin.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public void modifiyName(Args args){
4343
if(AxolotlClient.CONFIG != null) {
4444
AbstractClientPlayerEntity player = args.get(0);
4545
if(player.getUuid() == MinecraftClient.getInstance().player.getUuid() &&
46-
NickHider.Instance.hideOwnName.get()){
47-
args.set(1, Text.literal(NickHider.Instance.hiddenNameSelf.get()));
46+
NickHider.getInstance().hideOwnName.get()){
47+
args.set(1, Text.literal(NickHider.getInstance().hiddenNameSelf.get()));
4848
} else if(player.getUuid()!=MinecraftClient.getInstance().player.getUuid() &&
49-
NickHider.Instance.hideOtherNames.get()){
50-
args.set(1, Text.literal(NickHider.Instance.hiddenNameOthers.get()));
49+
NickHider.getInstance().hideOtherNames.get()){
50+
args.set(1, Text.literal(NickHider.getInstance().hiddenNameOthers.get()));
5151
}
5252
}
5353
}

src/main/java/io/github/axolotlclient/mixin/PlayerListEntryMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public abstract class PlayerListEntryMixin {
4343
@Inject(method = "getSkinTexture", at = @At("RETURN"), cancellable = true)
4444
public void hideSkins(CallbackInfoReturnable<Identifier> cir){
4545
if(profile.equals(MinecraftClient.getInstance().player.getGameProfile()) &&
46-
NickHider.Instance.hideOwnSkin.get()){
46+
NickHider.getInstance().hideOwnSkin.get()){
4747

4848
cir.setReturnValue(DefaultSkinHelper.getTexture(profile.getId()));
4949
} else if(!profile.equals(MinecraftClient.getInstance().player.getGameProfile()) &&
50-
NickHider.Instance.hideOtherSkins.get()){
50+
NickHider.getInstance().hideOtherSkins.get()){
5151

5252
cir.setReturnValue(DefaultSkinHelper.getTexture(profile.getId()));
5353
}

src/main/java/io/github/axolotlclient/mixin/PlayerListHudMixin.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ public GameProfile getPlayerGameProfile(PlayerListEntry instance){
6060
@Inject(method = "getPlayerName", at = @At("HEAD"), cancellable = true)
6161
public void nickHider(PlayerListEntry playerEntry, CallbackInfoReturnable<String> cir){
6262
if(playerEntry.getProfile().getId()==MinecraftClient.getInstance().player.getUuid() &&
63-
NickHider.Instance.hideOwnName.get()){
64-
cir.setReturnValue(NickHider.Instance.hiddenNameSelf.get());
63+
NickHider.getInstance().hideOwnName.get()){
64+
cir.setReturnValue(NickHider.getInstance().hiddenNameSelf.get());
6565
} else if(playerEntry.getProfile().getId()!=MinecraftClient.getInstance().player.getUuid() &&
66-
NickHider.Instance.hideOtherNames.get()){
67-
cir.setReturnValue(NickHider.Instance.hiddenNameOthers.get());
66+
NickHider.getInstance().hideOtherNames.get()){
67+
cir.setReturnValue(NickHider.getInstance().hiddenNameOthers.get());
6868
}
6969
}
7070

@@ -97,11 +97,11 @@ public int moveName(TextRenderer instance, MatrixStack matrices, Text text, floa
9797

9898
@ModifyArg(method = "getPlayerName", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;applyGameModeFormatting(Lnet/minecraft/client/network/PlayerListEntry;Lnet/minecraft/text/MutableText;)Lnet/minecraft/text/Text;"), index = 1)
9999
public MutableText hideNames(MutableText name){
100-
if(NickHider.Instance.hideOwnName.get()){
101-
return Text.literal(NickHider.Instance.hiddenNameSelf.get());
100+
if(NickHider.getInstance().hideOwnName.get()){
101+
return Text.literal(NickHider.getInstance().hiddenNameSelf.get());
102102
}
103-
if(NickHider.Instance.hideOtherNames.get()){
104-
return Text.literal(NickHider.Instance.hiddenNameOthers.get());
103+
if(NickHider.getInstance().hideOtherNames.get()){
104+
return Text.literal(NickHider.getInstance().hiddenNameOthers.get());
105105
}
106106
return name;
107107
}

src/main/java/io/github/axolotlclient/modules/hypixel/HypixelMods.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ public void init() {
5757
category.add(cacheMode);
5858

5959
addSubModule(LevelHead.getInstance());
60-
addSubModule(AutoGG.Instance);
61-
addSubModule(AutoTip.INSTANCE);
62-
addSubModule(NickHider.Instance);
63-
addSubModule(AutoBoop.Instance);
60+
addSubModule(AutoGG.getInstance());
61+
addSubModule(AutoTip.getInstance());
62+
addSubModule(NickHider.getInstance());
63+
addSubModule(AutoBoop.getInstance());
6464

6565
subModules.forEach(AbstractHypixelMod::init);
6666

src/main/java/io/github/axolotlclient/modules/hypixel/autoboop/AutoBoop.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@
2626
import io.github.axolotlclient.AxolotlclientConfig.options.OptionCategory;
2727
import io.github.axolotlclient.modules.hypixel.AbstractHypixelMod;
2828
import io.github.axolotlclient.util.Util;
29+
import lombok.Getter;
2930
import net.minecraft.text.Text;
3031

3132

3233
// Based on https://github.com/VeryHolyCheeeese/AutoBoop/blob/main/src/main/java/autoboop/AutoBoop.java
3334
public class AutoBoop implements AbstractHypixelMod {
3435

35-
public static AutoBoop Instance = new AutoBoop();
36+
@Getter
37+
private final static AutoBoop Instance = new AutoBoop();
3638

3739
protected OptionCategory cat = new OptionCategory("autoBoop");
3840
protected BooleanOption enabled = new BooleanOption("enabled", "autoBoop", false);

src/main/java/io/github/axolotlclient/modules/hypixel/autogg/AutoGG.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import io.github.axolotlclient.AxolotlclientConfig.options.StringOption;
2828
import io.github.axolotlclient.modules.hypixel.AbstractHypixelMod;
2929
import io.github.axolotlclient.util.Util;
30+
import lombok.Getter;
3031
import net.minecraft.client.MinecraftClient;
3132
import net.minecraft.text.Text;
3233

@@ -41,7 +42,8 @@
4142

4243
public class AutoGG implements AbstractHypixelMod {
4344

44-
public static AutoGG Instance = new AutoGG();
45+
@Getter
46+
private final static AutoGG Instance = new AutoGG();
4547

4648
private final OptionCategory category = new OptionCategory("autogg");
4749
private final MinecraftClient client = MinecraftClient.getInstance();

src/main/java/io/github/axolotlclient/modules/hypixel/autotip/AutoTip.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,31 @@
2626
import io.github.axolotlclient.AxolotlclientConfig.options.OptionCategory;
2727
import io.github.axolotlclient.modules.hypixel.AbstractHypixelMod;
2828
import io.github.axolotlclient.util.Util;
29+
import lombok.Getter;
2930
import net.minecraft.client.MinecraftClient;
31+
import net.minecraft.text.Text;
32+
33+
import java.util.regex.Pattern;
3034

3135
public class AutoTip implements AbstractHypixelMod {
3236

33-
public static AutoTip INSTANCE = new AutoTip();
37+
@Getter
38+
private final static AutoTip Instance = new AutoTip();
3439

3540
private final OptionCategory category = new OptionCategory("autotip");
3641

3742
private final BooleanOption enabled = new BooleanOption("enabled", false);
43+
private final BooleanOption hideMessages = new BooleanOption("hideTipMessages", false);
44+
45+
private final Pattern messagePattern = Pattern.compile("^You tipped [0-9]+ players in [0-9]+ different games!$");
46+
private final Pattern tippedPattern = Pattern.compile("^You already tipped everyone that has boosters active, so there isn't anybody to be tipped right now!$");
47+
3848
private long lastTime;
3949
private boolean init = false;
4050

4151
@Override
4252
public void init() {
43-
category.add(enabled);
53+
category.add(enabled, hideMessages);
4454
init=true;
4555
}
4656

@@ -64,6 +74,11 @@ public void tick() {
6474
}
6575
}
6676

77+
public boolean onChatMessage(Text text){
78+
return enabled.get() && hideMessages.get() &&
79+
(messagePattern.matcher(text.getString()).matches() || tippedPattern.matcher(text.getString()).matches());
80+
}
81+
6782
@Override
6883
public boolean tickable() {
6984
return true;

src/main/java/io/github/axolotlclient/modules/hypixel/nickhider/NickHider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@
2626
import io.github.axolotlclient.AxolotlclientConfig.options.OptionCategory;
2727
import io.github.axolotlclient.AxolotlclientConfig.options.StringOption;
2828
import io.github.axolotlclient.modules.hypixel.AbstractHypixelMod;
29+
import lombok.Getter;
2930
import net.minecraft.client.MinecraftClient;
3031
import net.minecraft.client.network.AbstractClientPlayerEntity;
3132
import net.minecraft.text.Text;
3233

3334
public class NickHider implements AbstractHypixelMod {
3435

35-
public static NickHider Instance = new NickHider();
36+
@Getter
37+
private final static NickHider Instance = new NickHider();
3638

3739
private final OptionCategory category = new OptionCategory("nickhider");
3840

0 commit comments

Comments
 (0)