Fixed issue where black scroll wouldnt remove enchants.

This commit is contained in:
Brianna 2019-12-28 17:39:49 -05:00
parent 094151904f
commit 25b977b37f

View File

@ -1,5 +1,6 @@
package com.songoda.epicenchants.utils; package com.songoda.epicenchants.utils;
import com.songoda.core.utils.TextUtils;
import com.songoda.epicenchants.EpicEnchants; import com.songoda.epicenchants.EpicEnchants;
import com.songoda.epicenchants.enums.EnchantResult; import com.songoda.epicenchants.enums.EnchantResult;
import com.songoda.epicenchants.enums.EventType; import com.songoda.epicenchants.enums.EventType;
@ -132,9 +133,12 @@ public class EnchantUtils {
return itemStack; return itemStack;
} }
String format = enchant.getFormat().replace("{level}", "").trim();
String text = format.isEmpty() ? enchant.getColoredIdentifier(false) : format;
nbtItem.getCompound("enchants").removeKey(enchant.getIdentifier()); nbtItem.getCompound("enchants").removeKey(enchant.getIdentifier());
ItemBuilder output = new ItemBuilder(nbtItem.getItem()); ItemBuilder output = new ItemBuilder(nbtItem.getItem());
output.removeLore(enchant.getFormat().replace("{level}", "").trim()); output.removeLore(TextUtils.formatText(text));
return output.build(); return output.build();
} }
} }