mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-23 10:35:15 +01:00
Fix enchantment detection
This commit is contained in:
parent
d1732552b0
commit
919b9728f5
@ -182,7 +182,11 @@ public class MaterialUtil {
|
||||
Map<org.bukkit.enchantments.Enchantment, Integer> enchantments = getEnchantments(itemName);
|
||||
|
||||
if (!enchantments.isEmpty()) {
|
||||
itemStack.addEnchantments(enchantments);
|
||||
try {
|
||||
itemStack.addEnchantments(enchantments);
|
||||
} catch (IllegalArgumentException exception) {
|
||||
//Do nothing, because the enchantment can't be applied
|
||||
}
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
@ -237,7 +241,7 @@ public class MaterialUtil {
|
||||
* @return Enchantments found
|
||||
*/
|
||||
public static Map<org.bukkit.enchantments.Enchantment, Integer> getEnchantments(String base32) {
|
||||
if (base32 == null) {
|
||||
if (base32 == null || base32.isEmpty()) {
|
||||
return new HashMap<org.bukkit.enchantments.Enchantment, Integer>();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user