Quick fix

This commit is contained in:
Roch Blonndiaux 2023-03-15 14:05:51 +01:00
parent 5f1e32d581
commit c342b4add2

View File

@ -200,7 +200,7 @@ public class StatManager {
} }
private void registerCustomStat(@NotNull ConfigurationSection section) { private void registerCustomStat(@NotNull ConfigurationSection section) {
final String name = section.getString("name"); String name = section.getString("name");
final String type = section.getString("type"); final String type = section.getString("type");
Validate.notNull(section, "Cannot register a custom stat from a null section"); Validate.notNull(section, "Cannot register a custom stat from a null section");
@ -234,6 +234,9 @@ public class StatManager {
else if (section.isString("lore")) else if (section.isString("lore"))
lore = new String[]{section.getString("lore")}; lore = new String[]{section.getString("lore")};
// Format name
name = name.replace(" ", "_").replace("-", "_").toUpperCase();
// Create a new stat instance // Create a new stat instance
try { try {
ItemStat<?, ?> stat = statClass.getConstructor(String.class, Material.class, String.class, String[].class, String[].class, Material[].class) ItemStat<?, ?> stat = statClass.getConstructor(String.class, Material.class, String.class, String[].class, String[].class, Material[].class)