Fixes several bugs and problems
Fixes getting the name of enchantments Fixes inconsistencies in material and enchantment name-checking Allows using "null" or "-1" to unset per-material or per-enchantment configuration options Fixes a bug where basePrice was set to a material name instead of the price for the material being displayed Adds missing tab-completion for material/enchantment costs Prevents inconsistencies in deciding if a value is null
This commit is contained in:
		@@ -4,8 +4,8 @@ import net.citizensnpcs.api.npc.NPC;
 | 
			
		||||
import net.knarcraft.blacksmith.BlacksmithPlugin;
 | 
			
		||||
import net.knarcraft.blacksmith.config.NPCSettings;
 | 
			
		||||
import net.knarcraft.blacksmith.manager.EconomyManager;
 | 
			
		||||
import net.knarcraft.blacksmith.util.InputParsingHelper;
 | 
			
		||||
import net.knarcraft.blacksmith.util.ItemHelper;
 | 
			
		||||
import org.bukkit.NamespacedKey;
 | 
			
		||||
import org.bukkit.enchantments.Enchantment;
 | 
			
		||||
import org.bukkit.entity.LivingEntity;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
@@ -57,7 +57,7 @@ public class ReforgeSession implements Runnable {
 | 
			
		||||
        if (enchantments[0] == null) {
 | 
			
		||||
            int i = 0;
 | 
			
		||||
            for (Enchantment enchantment : Enchantment.values()) {
 | 
			
		||||
                enchantments[i++] = enchantment.getKey().toString();
 | 
			
		||||
                enchantments[i++] = enchantment.getKey().getKey();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -140,7 +140,7 @@ public class ReforgeSession implements Runnable {
 | 
			
		||||
        //Find usable enchantments first
 | 
			
		||||
        List<Enchantment> usableEnchantments = new ArrayList<>();
 | 
			
		||||
        for (String enchantmentName : enchantments) {
 | 
			
		||||
            Enchantment enchantment = Enchantment.getByKey(NamespacedKey.fromString(enchantmentName));
 | 
			
		||||
            Enchantment enchantment = InputParsingHelper.matchEnchantment(enchantmentName);
 | 
			
		||||
            if (enchantment != null && enchantment.canEnchantItem(itemToReforge)) {
 | 
			
		||||
                usableEnchantments.add(enchantment);
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user