Skip to content

Commit

Permalink
Fixes incorrectly generated generator and bundle from template file.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Dec 6, 2020
1 parent bfb175f commit 14ca383
Showing 1 changed file with 41 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,30 @@ private void createGenerators(YamlConfiguration config, @Nullable User user, Gam

if (details != null)
{
// Read prefix
generatorTier.setFriendlyName(details.getString("prefix",
// Set name for description
generatorTier.setFriendlyName(details.getString("name",
generatorId.replaceAll("_", " ")));

// Read description
generatorTier.setDescription(details.getStringList("description"));
// Read icon
if (details.isList("description"))
{
generatorTier.setDescription(details.getStringList("description"));
}
else if (details.isString("description"))
{
String description = details.getString("description");

if (description != null)
{
// Define as list.
generatorTier.setDescription(Arrays.asList(
description.replaceAll("\\|", "\n").
split("\n").
clone()));
}
}

// Read icon
// TODO: 1.15.2 compatibility
ItemStack icon = ItemParser.parse(details.getString("icon"));
generatorTier.setGeneratorIcon(icon == null ? new ItemStack(Material.PAPER) : icon);
Expand Down Expand Up @@ -251,10 +268,28 @@ private void createGenerators(YamlConfiguration config, @Nullable User user, Gam
if (details != null)
{
// Read prefix
generatorBundle.setFriendlyName(details.getString("prefix",
generatorBundle.setFriendlyName(details.getString("name",
bundleId.replaceAll("_", " ")));

// Read description
generatorBundle.setDescription(details.getStringList("description"));
if (details.isList("description"))
{
generatorBundle.setDescription(details.getStringList("description"));
}
else if (details.isString("description"))
{
String description = details.getString("description");

if (description != null)
{
// Define as list.
generatorBundle.setDescription(Arrays.asList(
description.replaceAll("\\|", "\n").
split("\n").
clone()));
}
}

// Read icon
ItemStack icon = ItemParser.parse(details.getString("icon"));
generatorBundle.setGeneratorIcon(icon == null ? new ItemStack(Material.PAPER) : icon);
Expand Down

0 comments on commit 14ca383

Please sign in to comment.