Skip to content

Commit

Permalink
Fix Feature Toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko committed Dec 2, 2024
1 parent 5b5ad50 commit 06ebc28
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable<IConfig
private final static String FEATURE_KEY = Reference.MOD_ID+ ".config.feature_toggle";

private final String name;
private final String comment;
private final String prettyName;
private final String translatedName;
private String comment;
private String prettyName;
private String translatedName;
private final IKeybind keybind;
private final boolean defaultValueBoolean;
private final boolean singlePlayer;
Expand Down Expand Up @@ -251,21 +251,25 @@ public String getName()
public String getConfigGuiDisplayName()
{
// This doesn't get called ?
String name = StringUtils.getTranslatedOrFallback(this.getTranslatedName(), this.getName());
String name = StringUtils.getTranslatedOrFallback(this.translatedName, this.name);

if (this.singlePlayer)
{
return GuiBase.TXT_GOLD + name + GuiBase.TXT_RST;
name = GuiBase.TXT_GOLD + name + GuiBase.TXT_RST;
}

System.out.printf("FeatureToggle#getConfigGuiDisplayName(): translatedName [%s] // test [%s]\n", this.translatedName, name);
return name;
}

@Override
public String getPrettyName()
{
return StringUtils.getTranslatedOrFallback(this.prettyName,
String test = StringUtils.getTranslatedOrFallback(this.prettyName,
!this.prettyName.isEmpty() ? this.prettyName : StringUtils.splitCamelCase(this.name.substring(5)));

System.out.printf("FeatureToggle#getPrettyName(): prettyName [%s] // test [%s]\n", this.prettyName, test);
return test;
}

@Override
Expand Down Expand Up @@ -310,6 +314,7 @@ public String getComment()
return comment + "\n" + StringUtils.translate("tweakeroo.label.config_comment.single_player_only");
}

System.out.printf("FeatureToggle#getComment(): comment [%s] // test [%s]\n", this.comment, comment);
return comment;
}

Expand All @@ -319,6 +324,24 @@ public String getTranslatedName()
return this.translatedName;
}

@Override
public void setPrettyName(String s)
{
this.prettyName = s;
}

@Override
public void setTranslatedName(String s)
{
this.translatedName = s;
}

@Override
public void setComment(String s)
{
this.comment = s;
}

private static String buildTranslateName(String name, String type)
{
return FEATURE_KEY + "." + type + "." + name;
Expand Down

0 comments on commit 06ebc28

Please sign in to comment.