Skip to content

Commit

Permalink
Clean up methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Feb 3, 2022
1 parent 0728556 commit 83c0263
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ private String generateRequirementsDescription(GeneratorTierObject generator,
{
biomes.append("\n");
biomes.append(this.user.getTranslationOrNothing(reference + "biome",
Constants.BIOME, Utils.prettifyObject(this.user, biome)));
Constants.BIOME, Utils.prettifyObject(biome, this.user)));
});
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ private PanelItem createButton(Button button)
{
this.generatorTier.getRequiredBiomes().stream().sorted().forEach(biome ->
description.add(this.user.getTranslation(reference + ".value",
Constants.BIOME, Utils.prettifyObject(this.user, biome))));
Constants.BIOME, Utils.prettifyObject(biome, this.user))));
}

clickHandler = (panel, user, clickType, i) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ private PanelItem createButton(Button button)

this.generatorTier.getRequiredBiomes().stream().sorted().forEach(biome ->
description.add(this.user.getTranslation(reference + ".value",
Constants.BIOME, Utils.prettifyObject(this.user, biome))));
Constants.BIOME, Utils.prettifyObject(biome, this.user))));

break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private PanelItem createButton(Action button)

for (Biome biome : this.selectedBiomes) {
description.add(this.user.getTranslation(reference + ".list-value",
Constants.VALUE, Utils.prettifyObject(this.user, biome)));
Constants.VALUE, Utils.prettifyObject(biome, this.user)));
}
}

Expand Down Expand Up @@ -260,7 +260,7 @@ else if (this.selectedBiomes.contains(biome))
}

String name = this.user.getTranslation(Constants.BUTTON + "biome-icon.name",
Constants.BIOME, Utils.prettifyObject(this.user, biome));
Constants.BIOME, Utils.prettifyObject(biome, this.user));

return new PanelItemBuilder().
name(name).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,58 +671,6 @@ public static String prettifyObject(Biome biome, User user)
}


/**
* This method prettify given Biome name to more friendly name.
*
* @param user User which translation set will be used.
* @param biome Biome that requires prettifying.
* @return Clean and readable biome name.
*/
public static String prettifyObject(User user, Biome biome)
{
// Find addon structure with:
// [addon]:
// biomes:
// [biome]:
// name: [name]
String translation = user.getTranslationOrNothing(Constants.BIOMES + biome.name().toLowerCase() + ".name");

if (!translation.isEmpty())
{
// We found our translation.
return translation;
}

// Find addon structure with:
// [addon]:
// biomes:
// [biome]: [name]

translation = user.getTranslationOrNothing(Constants.BIOMES + biome.name().toLowerCase());

if (!translation.isEmpty())
{
// We found our translation.
return translation;
}

// Find general structure with:
// biomes:
// [biome]: [name]

translation = user.getTranslationOrNothing("biomes." + biome.name().toLowerCase());

if (!translation.isEmpty())
{
// We found our translation.
return translation;
}

// Nothing was found. Use just a prettify text function.
return Util.prettifyText(biome.name());
}


/**
* This method prettify given material name to more friendly name.
*
Expand Down

0 comments on commit 83c0263

Please sign in to comment.