mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-28 15:41:04 +01:00
Removed #advanced-enchants# for less confusion
This commit is contained in:
parent
d555fe71b4
commit
1aed93ced9
@ -22,7 +22,7 @@ public interface EnchantPlugin<T extends Enchantment> {
|
||||
* @param enchant Enchant being checked
|
||||
* @return If this enchant plugin handles a given enchant
|
||||
*/
|
||||
public boolean isCustomEnchant(Enchantment enchant);
|
||||
boolean isCustomEnchant(Enchantment enchant);
|
||||
|
||||
/**
|
||||
* Called when an item is built. This should be used to add the enchantment
|
||||
@ -32,7 +32,7 @@ public interface EnchantPlugin<T extends Enchantment> {
|
||||
* @param enchant Enchantment being applied
|
||||
* @param level Enchant level
|
||||
*/
|
||||
public void handleEnchant(ItemStackBuilder builder, T enchant, int level);
|
||||
void handleEnchant(ItemStackBuilder builder, T enchant, int level);
|
||||
|
||||
public NamespacedKey getNamespacedKey(String key);
|
||||
NamespacedKey getNamespacedKey(String key);
|
||||
}
|
||||
|
@ -5,19 +5,12 @@ import io.lumine.mythicenchants.enchants.MythicEnchant;
|
||||
import io.lumine.mythicenchants.util.LoreParser;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
|
||||
public class MythicEnchantsSupport implements EnchantPlugin<MythicEnchant> {
|
||||
|
||||
/*public void reparseWeapon(AbstractPlayer player) {
|
||||
MythicEnchantsHelper.reparseWeapon(player);
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public boolean isCustomEnchant(Enchantment enchant) {
|
||||
return enchant instanceof MythicEnchant;
|
||||
@ -28,12 +21,6 @@ public class MythicEnchantsSupport implements EnchantPlugin<MythicEnchant> {
|
||||
return new NamespacedKey(MythicEnchants.inst(), key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete copy and paste of the class {@link MythicEnchant#applyToItem(ItemStack, int)}
|
||||
* because that method takes as parameter a fully generated item and updates its meta.
|
||||
* Since meta is being generated in parallel to the itemStack in MMOItems, we need
|
||||
* to update its lore manually.
|
||||
*/
|
||||
public void handleEnchant(ItemStackBuilder builder, MythicEnchant enchant, int level) {
|
||||
Validate.isTrue(level > 0, "Level must be strictly positive");
|
||||
|
||||
@ -41,31 +28,5 @@ public class MythicEnchantsSupport implements EnchantPlugin<MythicEnchant> {
|
||||
|
||||
if (!builder.getMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS))
|
||||
builder.getLore().insert(0, LoreParser.formatEnchantment(enchant, level));
|
||||
|
||||
if (builder.getItemStack().getType() == Material.ENCHANTED_BOOK) {
|
||||
EnchantmentStorageMeta meta = (EnchantmentStorageMeta) builder.getMeta();
|
||||
|
||||
if (!builder.getMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS))
|
||||
builder.getLore().insert(0, LoreParser.formatEnchantment(enchant, level));
|
||||
|
||||
/* lvl = (Integer)this.getEnchantManager().getMythicEnchants(item).getOrDefault(this, 0);
|
||||
if (lvl > 0) {
|
||||
((List)lore).remove(LoreParser.formatEnchantment(this, lvl));
|
||||
}*/
|
||||
|
||||
// Now handled in the Enchants item stat
|
||||
// meta.addStoredEnchant(this, level, true);
|
||||
} else {
|
||||
/*lvl = (Integer)this.getEnchantManager().getMythicEnchants(item).getOrDefault(this, 0);
|
||||
if (lvl > 0) {
|
||||
((List)lore).remove(LoreParser.formatEnchantment(this, lvl));
|
||||
}*/
|
||||
|
||||
if (!builder.getMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS))
|
||||
builder.getLore().insert(0, LoreParser.formatEnchantment(enchant, level));
|
||||
|
||||
// Now handled in the Enchants stat
|
||||
// item.addUnsafeEnchantment(this, level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import java.util.Optional;
|
||||
*/
|
||||
public class AdvancedEnchantsStat extends ItemStat implements InternalStat {
|
||||
public AdvancedEnchantsStat() {
|
||||
super("ADVANCED_ENCHANTS", VersionMaterial.EXPERIENCE_BOTTLE.toMaterial(), "Advanced Enchants", new String[]{"The AEnchants of this. Format:", "\u00a7e[internal_name] [level]"}, new String[]{"!miscellaneous", "!block", "all"});
|
||||
super("ADVANCED_ENCHANTS", VersionMaterial.EXPERIENCE_BOTTLE.toMaterial(), "Advanced Enchants", new String[]{"The AEnchants of this item. Format:", "\u00a7e[internal_name] [level]"}, new String[]{"!miscellaneous", "!block", "all"});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -40,7 +40,6 @@ public class AdvancedEnchantsStat extends ItemStat implements InternalStat {
|
||||
|
||||
// Do that
|
||||
Map<String, Integer> aes = ((AdvancedEnchantMap) data).enchants;
|
||||
ArrayList<String> loreInserts = new ArrayList<>();
|
||||
|
||||
// Enchant the item
|
||||
for (String ench : aes.keySet()) {
|
||||
@ -57,11 +56,9 @@ public class AdvancedEnchantsStat extends ItemStat implements InternalStat {
|
||||
return;
|
||||
|
||||
// Add lore and tag
|
||||
loreInserts.add(instance.getDisplay(lvl));
|
||||
item.getLore().insert(0, instance.getDisplay(lvl));
|
||||
item.addItemTag(getEnchantTag(ench, lvl));
|
||||
}
|
||||
|
||||
item.getLore().insert(getPath(), loreInserts);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@ -97,6 +94,8 @@ public class AdvancedEnchantsStat extends ItemStat implements InternalStat {
|
||||
return new AdvancedEnchantMap();
|
||||
}
|
||||
|
||||
private static final String AE_TAG = "ae_enchantment";
|
||||
|
||||
/**
|
||||
* @param name Name of the AEnch ~ arrow_deflect
|
||||
* @param level Level of the AEnch ~ 4
|
||||
@ -106,9 +105,6 @@ public class AdvancedEnchantsStat extends ItemStat implements InternalStat {
|
||||
return new ItemTag(AE_TAG + ";" + name, level);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static final String AE_TAG = "ae_enchantment";
|
||||
|
||||
@Override
|
||||
public void whenLoaded(@NotNull ReadMMOItem mmoitem) {
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
# Reload with /mmoitems reload
|
||||
lore-format:
|
||||
# - '{bar}&8&m--------&f&l &nGeneral&8 &m--------------'
|
||||
- '#advanced-enchants#'
|
||||
- '#item-type#'
|
||||
- '{bar}'
|
||||
- '#required-class#'
|
||||
|
Loading…
Reference in New Issue
Block a user