Skip to content

Commit

Permalink
Merge pull request #133 from Aaur1s/staging
Browse files Browse the repository at this point in the history
Fixed Modded enchantments naming for Bukkit Plugins
  • Loading branch information
juanmuscaria authored Jun 22, 2023
2 parents 16017a9 + 713f792 commit 4a4c592
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ private static String generateName(net.minecraft.enchantment.Enchantment target)
if (StringUtils.containsIgnoreCase(candidate, "Enchantment")) {
candidate = candidate.replaceFirst("[E|e]nchantment", "");
// Add underscores at camelCase humps
candidate = candidate.replaceAll("([a-z])([A-Z])", "\1_\2").toUpperCase();
candidate = candidate.replaceAll("([a-z])([A-Z])", "$1_$2").toUpperCase();
candidate = addSuffix(candidate.toUpperCase());
return candidate;
}
// fall back to the FQN if naming pattern is broken
candidate = clz.getName();
candidate = candidate.replaceAll("([a-z])([A-Z])", "\1_\2");
candidate = candidate.replaceAll("([a-z])([A-Z])", "$1_$2");
candidate = candidate.replaceAll("\\.", "_");
candidate = addSuffix(candidate.toUpperCase());
return candidate;
Expand Down

0 comments on commit 4a4c592

Please sign in to comment.