Skip to content

Commit

Permalink
feat: add option for the chat channel buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
AsoDesu committed Dec 19, 2023
1 parent 3505d34 commit 51770ab
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.asodev.islandutils.mixins.ui;

import net.asodev.islandutils.modules.ChatChannelButton;
import net.asodev.islandutils.options.IslandOptions;
import net.asodev.islandutils.util.PlainTextButtonNoShadow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
Expand Down Expand Up @@ -40,7 +41,7 @@ protected ChatScreenMixin(Component component) {

@Inject(method = "init", at = @At("TAIL"))
private void init(CallbackInfo ci) {
if (!isOnline()) return;
if (!isOnline() || !IslandOptions.getMisc().showChannelSwitchers()) return;
buttons.clear();

int x = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class MiscOptions implements OptionsCategory {
boolean showFriendsInGame = true;
boolean showFriendsInLobby = true;
boolean silverPreview = true;
boolean channelSwitchers = true;
boolean enableConfigButton = true;
boolean debugMode = false;

Expand All @@ -35,6 +36,9 @@ public boolean isSilverPreview() {
public boolean isEnableConfigButton() {
return enableConfigButton;
}
public boolean showChannelSwitchers() {
return channelSwitchers;
}
public boolean isDebugMode() {
return debugMode;
}
Expand Down Expand Up @@ -65,6 +69,12 @@ public ConfigCategory getCategory() {
.controller(TickBoxControllerBuilder::create)
.binding(defaults.silverPreview, () -> silverPreview, value -> this.silverPreview = value)
.build();
Option<Boolean> channelsOption = Option.<Boolean>createBuilder()
.name(Component.translatable("text.autoconfig.islandutils.option.channelSwitchers"))
.description(OptionDescription.of(Component.translatable("text.autoconfig.islandutils.option.channelSwitchers.@Tooltip")))
.controller(TickBoxControllerBuilder::create)
.binding(defaults.channelSwitchers, () -> channelSwitchers, value -> this.channelSwitchers = value)
.build();
Option<Boolean> buttonOption = Option.<Boolean>createBuilder()
.name(Component.translatable("text.autoconfig.islandutils.option.enableConfigButton"))
.description(OptionDescription.of(Component.translatable("text.autoconfig.islandutils.option.enableConfigButton.@Tooltip")))
Expand All @@ -88,6 +98,7 @@ public ConfigCategory getCategory() {
.option(showFriendsLobbyOption)
.build())
.option(silverOption)
.option(channelsOption)
.option(buttonOption)
.group(OptionGroup.createBuilder()
.name(Component.literal("Debug Options"))
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/island/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
"text.autoconfig.islandutils.option.showFriendsInLobby.@Tooltip": "When you join or change lobbies, a message will be put in chat with the friends in your lobby",
"text.autoconfig.islandutils.option.silverPreview": "Show scavenging item totals",
"text.autoconfig.islandutils.option.silverPreview.@Tooltip": "Shows all the items you'll earn in the Scavenging menu",
"text.autoconfig.islandutils.option.channelSwitchers": "Show chat channel buttons",
"text.autoconfig.islandutils.option.channelSwitchers.@Tooltip": "Shows the chat channel switcher buttons above the chat box",
"text.autoconfig.islandutils.option.hideSliders": "Hide Sound Sliders if not Online",
"text.autoconfig.islandutils.option.hideSliders.@Tooltip": "Hides the Music Sliders if you're not on MCC Island",

Expand Down

0 comments on commit 51770ab

Please sign in to comment.