Skip to content

Commit

Permalink
Adding to settings display
Browse files Browse the repository at this point in the history
  • Loading branch information
Incandescent-Turtle committed Jul 15, 2024
1 parent 2d28303 commit 25a4aef
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public static MutableText createSettings()
txt.append(createHighlightThroughBlocksText(settings));
txt.append("\n\n");
txt.append(createHighlightWhileSneakingText(settings));
txt.append("\n\n");
txt.append(createHighlightAllPlayersText(settings));
return txt;
}

Expand Down Expand Up @@ -242,4 +244,29 @@ private static MutableText createHighlightWhileSneakingText(FHSettings settings)
tooltipText.append(dontHighlight);
return tooltipText;
}

private static MutableText createHighlightAllPlayersText(FHSettings settings) {
var title = FHUtils.colorText("Highlight All Players", Color.ORANGE.getRGB());

var status = settings.highlightAllPlayers;
var highlight = CommandUtils.addHoverAndClickEvent(
Text.literal("Highlight").styled(style -> style.withColor(status ? Formatting.GREEN : Formatting.RED).withBold(status)),
"PLACEHOLDER - LINK VIA LANG",
"/fh settings set highlightALlPlayers highlight"
);

var dontHighlight = CommandUtils.addHoverAndClickEvent(
Text.literal("Don't Highlight").styled(style -> style.withColor(status ? Formatting.RED : Formatting.GREEN).withBold(!status)),
"PLACEHOLDER - LINK VIA LANG",
"/fh settings set highlightALlPlayers dontHighlight"
);

var tooltipText = Text.literal("");
tooltipText.append(title);
tooltipText.append("\n ↳ ");
tooltipText.append(highlight);
tooltipText.append(" | ");
tooltipText.append(dontHighlight);
return tooltipText;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private static void registerKeyInputs(MinecraftClient client)
}
if(highlightPlayers.wasPressed()) {
FHSettings.getSettings().highlightAllPlayers = !FHSettings.getSettings().highlightAllPlayers;
FriendHighlighter.sendMessage(Text.of("All player highlight toggled"));
FriendHighlighter.sendMessage(FHUtils.getMessageWithConnotation("ENABLED", "DISABLED", FHSettings.getSettings().highlightAllPlayers));
FriendHighlighter.COMMAND_HANDLER.updateLists();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"key.category.friendhighlighter.utils": "Friend Highlighter",
"key.friendhighlighter.opengui": "Open Mod Settings",
"key.friendhighlighter.highlight": "Toggle Highlighter",
"key.friendhighlighter.highlightplayers": "Toggle Highlighting All players",

"config.friendHighlighter.title": "Friend Highlighter Config",
"config.friendHighlighter.category.friendsList": "Friends List"
Expand Down

0 comments on commit 25a4aef

Please sign in to comment.