Fixed custom scoreboard toggle not working

This commit is contained in:
NK 2023-05-26 19:13:23 +01:00
parent 0c92cd98b3
commit 5f09236144

View file

@ -14,6 +14,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static me.night0721.lilase.config.AHConfig.CUSTOM_SCOREBOARD;
/* /*
Credits: Cephetir Credits: Cephetir
*/ */
@ -23,8 +25,8 @@ public class MixinGuiIngame {
@ModifyArg(method = "renderScoreboard", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawString(Ljava/lang/String;III)I")) @ModifyArg(method = "renderScoreboard", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawString(Ljava/lang/String;III)I"))
public String a(String text) { public String a(String text) {
String txt = keepScoreboardCharacters(stripColor(text)).trim(); String txt = keepScoreboardCharacters(stripColor(text)).trim();
if (txt.startsWith("www")) return " §4w§cw§6w§e.§2n§ai§bg§3h§1t§90§d7§42§c1§6.§em§2e "; if (txt.startsWith("www") && CUSTOM_SCOREBOARD) return " §4w§cw§6w§e.§2n§ai§bg§3h§1t§90§d7§42§c1§6.§em§2e ";
if (txt.startsWith("SKY")) return " §d§lLILASE "; if (txt.startsWith("SKY") && CUSTOM_SCOREBOARD) return " §d§lLILASE ";
if (Pattern.compile("\\d{2}/\\d{2}/\\d{2}").matcher(txt).find()) return txt.split(" ")[0]; if (Pattern.compile("\\d{2}/\\d{2}/\\d{2}").matcher(txt).find()) return txt.split(" ")[0];
if (text.startsWith(String.valueOf(EnumChatFormatting.RED)) && Pattern.compile("\\d+").matcher(txt).matches()) return ""; if (text.startsWith(String.valueOf(EnumChatFormatting.RED)) && Pattern.compile("\\d+").matcher(txt).matches()) return "";
else return text; else return text;