mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-31 06:07:34 +01:00
Fixed modifier application
This commit is contained in:
parent
dbd1936609
commit
b89734a211
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.api;
|
|||||||
|
|
||||||
import io.lumine.mythic.lib.MythicLib;
|
import io.lumine.mythic.lib.MythicLib;
|
||||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||||
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
import io.lumine.mythic.lib.player.modifier.ModifierSource;
|
||||||
import net.Indyuce.mmoitems.MMOItems;
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
import net.Indyuce.mmoitems.api.item.util.identify.UnidentifiedItem;
|
import net.Indyuce.mmoitems.api.item.util.identify.UnidentifiedItem;
|
||||||
import net.Indyuce.mmoitems.manager.TypeManager;
|
import net.Indyuce.mmoitems.manager.TypeManager;
|
||||||
@ -22,46 +22,45 @@ import java.util.Objects;
|
|||||||
public class Type {
|
public class Type {
|
||||||
|
|
||||||
// Slashing
|
// Slashing
|
||||||
public static final Type SWORD = new Type(TypeSet.SLASHING, "SWORD", true, EquipmentSlot.MAIN_HAND);
|
public static final Type SWORD = new Type(TypeSet.SLASHING, "SWORD", true, ModifierSource.MELEE_WEAPON);
|
||||||
|
|
||||||
// Piercing
|
// Piercing
|
||||||
public static final Type DAGGER = new Type(TypeSet.PIERCING, "DAGGER", true, EquipmentSlot.MAIN_HAND);
|
public static final Type DAGGER = new Type(TypeSet.PIERCING, "DAGGER", true, ModifierSource.MELEE_WEAPON);
|
||||||
public static final Type SPEAR = new Type(TypeSet.PIERCING, "SPEAR", true, EquipmentSlot.MAIN_HAND);
|
public static final Type SPEAR = new Type(TypeSet.PIERCING, "SPEAR", true, ModifierSource.MELEE_WEAPON);
|
||||||
|
|
||||||
// Blunt
|
// Blunt
|
||||||
public static final Type HAMMER = new Type(TypeSet.BLUNT, "HAMMER", true, EquipmentSlot.MAIN_HAND);
|
public static final Type HAMMER = new Type(TypeSet.BLUNT, "HAMMER", true, ModifierSource.MELEE_WEAPON);
|
||||||
public static final Type GAUNTLET = new Type(TypeSet.BLUNT, "GAUNTLET", true, EquipmentSlot.MAIN_HAND);
|
public static final Type GAUNTLET = new Type(TypeSet.BLUNT, "GAUNTLET", true, ModifierSource.MELEE_WEAPON);
|
||||||
|
|
||||||
// Range
|
// Range
|
||||||
public static final Type WHIP = new Type(TypeSet.RANGE, "WHIP", true, EquipmentSlot.MAIN_HAND);
|
public static final Type WHIP = new Type(TypeSet.RANGE, "WHIP", true, ModifierSource.RANGED_WEAPON);
|
||||||
public static final Type STAFF = new Type(TypeSet.RANGE, "STAFF", true, EquipmentSlot.MAIN_HAND);
|
public static final Type STAFF = new Type(TypeSet.RANGE, "STAFF", true, ModifierSource.RANGED_WEAPON);
|
||||||
public static final Type BOW = new Type(TypeSet.RANGE, "BOW", true, EquipmentSlot.MAIN_HAND);
|
public static final Type BOW = new Type(TypeSet.RANGE, "BOW", true, ModifierSource.RANGED_WEAPON);
|
||||||
public static final Type CROSSBOW = new Type(TypeSet.RANGE, "CROSSBOW", false, EquipmentSlot.MAIN_HAND);
|
public static final Type CROSSBOW = new Type(TypeSet.RANGE, "CROSSBOW", false, ModifierSource.RANGED_WEAPON);
|
||||||
public static final Type MUSKET = new Type(TypeSet.RANGE, "MUSKET", true, EquipmentSlot.MAIN_HAND);
|
public static final Type MUSKET = new Type(TypeSet.RANGE, "MUSKET", true, ModifierSource.RANGED_WEAPON);
|
||||||
public static final Type LUTE = new Type(TypeSet.RANGE, "LUTE", true, EquipmentSlot.MAIN_HAND);
|
public static final Type LUTE = new Type(TypeSet.RANGE, "LUTE", true, ModifierSource.RANGED_WEAPON);
|
||||||
|
|
||||||
// Hand Accessories
|
// Hand Accessories
|
||||||
public static final Type CATALYST = new Type(TypeSet.OFFHAND, "CATALYST", false, EquipmentSlot.MAIN_HAND);
|
public static final Type CATALYST = new Type(TypeSet.EXTRA, "CATALYST", false, ModifierSource.HAND_ITEM);
|
||||||
public static final Type OFF_CATALYST = new Type(TypeSet.OFFHAND, "OFF_CATALYST", false, EquipmentSlot.OFF_HAND);
|
public static final Type OFF_CATALYST = new Type(TypeSet.EXTRA, "OFF_CATALYST", false, ModifierSource.OFFHAND_ITEM);
|
||||||
public static final Type MAIN_CATALYST = new Type(TypeSet.OFFHAND, "MAIN_CATALYST", false, EquipmentSlot.MAIN_HAND);
|
public static final Type MAIN_CATALYST = new Type(TypeSet.EXTRA, "MAIN_CATALYST", false, ModifierSource.MAINHAND_ITEM);
|
||||||
|
|
||||||
// Any
|
// Any
|
||||||
public static final Type ORNAMENT = new Type(TypeSet.EXTRA, "ORNAMENT", false, EquipmentSlot.OTHER);
|
public static final Type ORNAMENT = new Type(TypeSet.EXTRA, "ORNAMENT", false, ModifierSource.OTHER);
|
||||||
|
|
||||||
// Extra
|
// Extra
|
||||||
public static final Type ARMOR = new Type(TypeSet.EXTRA, "ARMOR", false, EquipmentSlot.ARMOR);
|
public static final Type ARMOR = new Type(TypeSet.EXTRA, "ARMOR", false, ModifierSource.OTHER);
|
||||||
public static final Type TOOL = new Type(TypeSet.EXTRA, "TOOL", false, EquipmentSlot.MAIN_HAND);
|
public static final Type TOOL = new Type(TypeSet.EXTRA, "TOOL", false, ModifierSource.MELEE_WEAPON);
|
||||||
public static final Type CONSUMABLE = new Type(TypeSet.EXTRA, "CONSUMABLE", false, EquipmentSlot.MAIN_HAND);
|
public static final Type CONSUMABLE = new Type(TypeSet.EXTRA, "CONSUMABLE", false, ModifierSource.MAINHAND_ITEM);
|
||||||
public static final Type MISCELLANEOUS = new Type(TypeSet.EXTRA, "MISCELLANEOUS", false, EquipmentSlot.MAIN_HAND);
|
public static final Type MISCELLANEOUS = new Type(TypeSet.EXTRA, "MISCELLANEOUS", false, ModifierSource.MAINHAND_ITEM);
|
||||||
public static final Type GEM_STONE = new Type(TypeSet.EXTRA, "GEM_STONE", false, null);
|
public static final Type GEM_STONE = new Type(TypeSet.EXTRA, "GEM_STONE", false, ModifierSource.VOID);
|
||||||
public static final Type SKIN = new Type(TypeSet.EXTRA, "SKIN", false, null);
|
public static final Type SKIN = new Type(TypeSet.EXTRA, "SKIN", false, ModifierSource.VOID);
|
||||||
public static final Type ACCESSORY = new Type(TypeSet.EXTRA, "ACCESSORY", false, EquipmentSlot.ACCESSORY);
|
public static final Type ACCESSORY = new Type(TypeSet.EXTRA, "ACCESSORY", false, ModifierSource.OTHER);
|
||||||
public static final Type BLOCK = new Type(TypeSet.EXTRA, "BLOCK", false, null);
|
public static final Type BLOCK = new Type(TypeSet.EXTRA, "BLOCK", false, ModifierSource.VOID);
|
||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
private final TypeSet set;
|
private final TypeSet set;
|
||||||
@Nullable
|
private final ModifierSource modifierSource;
|
||||||
private final EquipmentSlot equipType;
|
|
||||||
private final boolean weapon;
|
private final boolean weapon;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
@ -91,14 +90,14 @@ public class Type {
|
|||||||
private final List<ItemStat> available = new ArrayList<>();
|
private final List<ItemStat> available = new ArrayList<>();
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Type(@NotNull TypeSet set, @NotNull String id, boolean weapon, @NotNull EquipmentSlot equipType, boolean fourGUIMode) {
|
public Type(TypeSet set, String id, boolean weapon, ModifierSource modSource, boolean fourGUIMode) {
|
||||||
this(set, id, weapon, equipType);
|
this(set, id, weapon, modSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Type(@NotNull TypeSet set, @NotNull String id, boolean weapon, @NotNull EquipmentSlot equipType) {
|
public Type(TypeSet set, String id, boolean weapon, ModifierSource modSource) {
|
||||||
this.set = set;
|
this.set = set;
|
||||||
this.id = id.toUpperCase().replace("-", "_").replace(" ", "_");
|
this.id = id.toUpperCase().replace("-", "_").replace(" ", "_");
|
||||||
this.equipType = equipType;
|
this.modifierSource = modSource;
|
||||||
this.weapon = weapon;
|
this.weapon = weapon;
|
||||||
this.loreFormat = null;
|
this.loreFormat = null;
|
||||||
}
|
}
|
||||||
@ -110,7 +109,7 @@ public class Type {
|
|||||||
|
|
||||||
set = (parent != null ? parent.set : TypeSet.EXTRA);
|
set = (parent != null ? parent.set : TypeSet.EXTRA);
|
||||||
weapon = (parent != null && parent.weapon);
|
weapon = (parent != null && parent.weapon);
|
||||||
equipType = (parent != null ? parent.equipType : EquipmentSlot.OTHER);
|
modifierSource = (parent != null ? parent.modifierSource : ModifierSource.OTHER);
|
||||||
this.loreFormat = config.getString("LoreFormat", (parent != null ? parent.loreFormat : null));
|
this.loreFormat = config.getString("LoreFormat", (parent != null ? parent.loreFormat : null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,9 +155,8 @@ public class Type {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
public ModifierSource getModifierSource() {
|
||||||
public EquipmentSlot getEquipmentType() {
|
return modifierSource;
|
||||||
return equipType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItem() {
|
public ItemStack getItem() {
|
||||||
@ -185,15 +183,7 @@ public class Type {
|
|||||||
* @return Does it display as four rows in /mmoitems browse?
|
* @return Does it display as four rows in /mmoitems browse?
|
||||||
*/
|
*/
|
||||||
public boolean isFourGUIMode() {
|
public boolean isFourGUIMode() {
|
||||||
return getSupertype().equipType == EquipmentSlot.ARMOR;
|
return getSupertype().modifierSource == ModifierSource.ARMOR;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return If an item can be equipped in both hands
|
|
||||||
*/
|
|
||||||
public boolean isHandItem() {
|
|
||||||
final @NotNull Type supertype = getSupertype();
|
|
||||||
return supertype.equipType == EquipmentSlot.MAIN_HAND && !supertype.equals(MAIN_CATALYST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +27,7 @@ public enum TypeSet {
|
|||||||
* Slashing weapons deal damage in a cone behind the player's initial
|
* Slashing weapons deal damage in a cone behind the player's initial
|
||||||
* target, which makes it a deadly AoE weapon for warriors
|
* target, which makes it a deadly AoE weapon for warriors
|
||||||
*/
|
*/
|
||||||
SLASHING(ModifierSource.MELEE_WEAPON, (attack, damager, target, weapon) -> {
|
SLASHING((attack, damager, target, weapon) -> {
|
||||||
if (!MMOItems.plugin.getConfig().getBoolean("item-ability.slashing.enabled") || damager.isOnCooldown(CooldownType.SET_TYPE_ATTACK))
|
if (!MMOItems.plugin.getConfig().getBoolean("item-ability.slashing.enabled") || damager.isOnCooldown(CooldownType.SET_TYPE_ATTACK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public enum TypeSet {
|
|||||||
* increased which makes it a perfect 'double or nothing' weapon for
|
* increased which makes it a perfect 'double or nothing' weapon for
|
||||||
* assassins
|
* assassins
|
||||||
*/
|
*/
|
||||||
PIERCING(ModifierSource.MELEE_WEAPON, (attack, damager, target, weapon) -> {
|
PIERCING((attack, damager, target, weapon) -> {
|
||||||
if (!MMOItems.plugin.getConfig().getBoolean("item-ability.piercing.enabled") || damager.isOnCooldown(CooldownType.SET_TYPE_ATTACK))
|
if (!MMOItems.plugin.getConfig().getBoolean("item-ability.piercing.enabled") || damager.isOnCooldown(CooldownType.SET_TYPE_ATTACK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ public enum TypeSet {
|
|||||||
* Blunt weapons are like 1.9 sweep attacks. They damage all enemies nearby
|
* Blunt weapons are like 1.9 sweep attacks. They damage all enemies nearby
|
||||||
* and apply a slight knockback
|
* and apply a slight knockback
|
||||||
*/
|
*/
|
||||||
BLUNT(ModifierSource.MELEE_WEAPON, (attack, damager, target, weapon) -> {
|
BLUNT((attack, damager, target, weapon) -> {
|
||||||
final Random random = new Random();
|
final Random random = new Random();
|
||||||
float pitchRange = 0.7f + random.nextFloat() * (0.9f - 0.7f);
|
float pitchRange = 0.7f + random.nextFloat() * (0.9f - 0.7f);
|
||||||
|
|
||||||
@ -114,49 +114,32 @@ public enum TypeSet {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
/**
|
|
||||||
* Any item type can may apply their stats even when worn in offhand.
|
|
||||||
* They're the only items with that specific property
|
|
||||||
*/
|
|
||||||
OFFHAND(ModifierSource.OTHER),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ranged attacks based weapons. when the player is too squishy to fight in
|
* Ranged attacks based weapons. when the player is too squishy to fight in
|
||||||
* the middle of the battle-field, these weapons allow him to take some
|
* the middle of the battle-field, these weapons allow him to take some
|
||||||
* distance and still deal some good damage
|
* distance and still deal some good damage
|
||||||
*/
|
*/
|
||||||
RANGE(ModifierSource.RANGED_WEAPON),
|
RANGE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Any other item type, like armor, consumables, etc. They all have their
|
* Any other item type, like armor, consumables, etc. They all have their
|
||||||
* very specific passive depending on their item type
|
* very specific passive depending on their item type
|
||||||
*/
|
*/
|
||||||
EXTRA(ModifierSource.OTHER);
|
EXTRA;
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface between MMOItems' type sets and MythicLibs' modifierSources which let
|
|
||||||
* MythicLib know what type of item is giving some stat modifiers to a player
|
|
||||||
*/
|
|
||||||
private final ModifierSource modifierSource;
|
|
||||||
|
|
||||||
private final SetAttackHandler attackHandler;
|
private final SetAttackHandler attackHandler;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
private TypeSet(ModifierSource modifierSource) {
|
private TypeSet() {
|
||||||
this(modifierSource, null);
|
this(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TypeSet(ModifierSource modifierSource, SetAttackHandler attackHandler) {
|
private TypeSet(SetAttackHandler attackHandler) {
|
||||||
this.attackHandler = attackHandler;
|
this.attackHandler = attackHandler;
|
||||||
this.modifierSource = modifierSource;
|
|
||||||
|
|
||||||
this.name = MMOUtils.caseOnWords(name().toLowerCase());
|
this.name = MMOUtils.caseOnWords(name().toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModifierSource getModifierSource() {
|
|
||||||
return modifierSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasAttackEffect() {
|
public boolean hasAttackEffect() {
|
||||||
return attackHandler != null;
|
return attackHandler != null;
|
||||||
}
|
}
|
||||||
|
@ -211,14 +211,14 @@ public class PlayerData {
|
|||||||
// Abilities
|
// Abilities
|
||||||
if (item.hasData(ItemStats.ABILITIES))
|
if (item.hasData(ItemStats.ABILITIES))
|
||||||
for (AbilityData abilityData : ((AbilityListData) item.getData(ItemStats.ABILITIES)).getAbilities()) {
|
for (AbilityData abilityData : ((AbilityListData) item.getData(ItemStats.ABILITIES)).getAbilities()) {
|
||||||
ModifierSource modSource = equipped.getCached().getType() == null ? ModifierSource.OTHER : equipped.getCached().getType().getItemSet().getModifierSource();
|
ModifierSource modSource = equipped.getCached().getType().getModifierSource();
|
||||||
mmoData.getPassiveSkillMap().addModifier(new PassiveSkill("MMOItemsItem", abilityData, equipped.getSlot(), modSource));
|
mmoData.getPassiveSkillMap().addModifier(new PassiveSkill("MMOItemsItem", abilityData, equipped.getSlot(), modSource));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modifier application rules
|
// Modifier application rules
|
||||||
final ModifierSource source = item.getType().getItemSet().getModifierSource();
|
final ModifierSource source = item.getType().getModifierSource();
|
||||||
final EquipmentSlot equipmentSlot = equipped.getSlot();
|
final EquipmentSlot equipmentSlot = equipped.getSlot();
|
||||||
if (source.isWeapon() && equipmentSlot == EquipmentSlot.MAIN_HAND.getOppositeHand())
|
if (!EquipmentSlot.MAIN_HAND.isCompatible(source, equipmentSlot))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Apply permanent potion effects
|
// Apply permanent potion effects
|
||||||
|
@ -70,8 +70,7 @@ public class PlayerStats {
|
|||||||
double value = item.getNBT().getStat(stat.getId());
|
double value = item.getNBT().getStat(stat.getId());
|
||||||
|
|
||||||
if (value != 0) {
|
if (value != 0) {
|
||||||
final Type type = item.getCached().getType();
|
final ModifierSource source = item.getCached().getType().getModifierSource();
|
||||||
final ModifierSource source = type == null ? ModifierSource.OTHER : type.getItemSet().getModifierSource();
|
|
||||||
|
|
||||||
// Apply hand weapon stat offset
|
// Apply hand weapon stat offset
|
||||||
if (source.isWeapon() && stat instanceof AttackWeaponStat)
|
if (source.isWeapon() && stat instanceof AttackWeaponStat)
|
||||||
|
@ -2,11 +2,14 @@ package net.Indyuce.mmoitems.api.player.inventory;
|
|||||||
|
|
||||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||||
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
||||||
|
import io.lumine.mythic.lib.player.modifier.ModifierSource;
|
||||||
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
import net.Indyuce.mmoitems.api.Type;
|
import net.Indyuce.mmoitems.api.Type;
|
||||||
import net.Indyuce.mmoitems.api.item.mmoitem.VolatileMMOItem;
|
import net.Indyuce.mmoitems.api.item.mmoitem.VolatileMMOItem;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class EquippedItem {
|
public class EquippedItem {
|
||||||
@ -54,33 +57,23 @@ public class EquippedItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The slot this equipped item is defined to be, will this <code>Type</code>
|
* This is a small optimization which reduces the amount of items
|
||||||
* actually add register its modifiers to the player when held here?
|
* taken into account by the MMOItems player inventory handler.
|
||||||
* <p>
|
*
|
||||||
* There's a difference between registering modifiers and applying it stats.
|
* @return If item placement is legal
|
||||||
* For instance, modifiers from both hands are registered if the placement is
|
|
||||||
* legal but might not be taken into account during stat calculation!
|
|
||||||
* <p>
|
|
||||||
* An <code>OFF_CATALYST</code> may only add in the <code>OFFHAND</code>, and such.
|
|
||||||
*/
|
*/
|
||||||
public boolean isPlacementLegal() {
|
public boolean isPlacementLegal() {
|
||||||
|
|
||||||
// Find item type
|
|
||||||
final String typeFormat = item.getString("MMOITEMS_ITEM_TYPE");
|
|
||||||
final Type type = typeFormat == null ? null : Type.get(typeFormat);
|
|
||||||
|
|
||||||
// Vanilla items are ignored
|
// Vanilla items are ignored
|
||||||
|
final @Nullable String typeFormat = item.getString("MMOITEMS_ITEM_TYPE");
|
||||||
|
if (typeFormat == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
final @Nullable Type type = MMOItems.plugin.getTypes().get(typeFormat);
|
||||||
if (type == null)
|
if (type == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Equips anywhere
|
final ModifierSource modSource = type.getModifierSource();
|
||||||
if (slot == EquipmentSlot.OTHER || type.getEquipmentType() == EquipmentSlot.OTHER)
|
return EquipmentSlot.OFF_HAND.isCompatible(modSource, slot) || EquipmentSlot.MAIN_HAND.isCompatible(modSource, slot);
|
||||||
return true;
|
|
||||||
|
|
||||||
// Hand items
|
|
||||||
if (type.isHandItem())
|
|
||||||
return slot.isHand();
|
|
||||||
|
|
||||||
return slot == type.getEquipmentType();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,6 +8,8 @@ import org.apache.commons.lang.Validate;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@ -20,9 +22,15 @@ public class TypeManager implements Reloadable {
|
|||||||
*/
|
*/
|
||||||
public void reload() {
|
public void reload() {
|
||||||
map.clear();
|
map.clear();
|
||||||
registerAll(Type.ACCESSORY, Type.ARMOR, Type.BLOCK, Type.BOW, Type.CATALYST, Type.CONSUMABLE, Type.CROSSBOW, Type.DAGGER, Type.GAUNTLET,
|
|
||||||
Type.GEM_STONE, Type.SKIN, Type.HAMMER, Type.LUTE, Type.MISCELLANEOUS, Type.MUSKET, Type.OFF_CATALYST, Type.ORNAMENT, Type.SPEAR,
|
// Load default types
|
||||||
Type.STAFF, Type.SWORD, Type.TOOL, Type.WHIP);
|
for (Field field : Type.class.getFields())
|
||||||
|
try {
|
||||||
|
if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && field.get(null) instanceof Type)
|
||||||
|
register((Type) field.get(null));
|
||||||
|
} catch (Exception exception) {
|
||||||
|
MMOItems.plugin.getLogger().log(Level.WARNING, "Couldn't register type called '" + field.getName() + "': " + exception.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register all other types. Important: check if the map already
|
* Register all other types. Important: check if the map already
|
||||||
|
@ -180,7 +180,7 @@ OFF_CATALYST:
|
|||||||
display: PRISMARINE_CRYSTALS
|
display: PRISMARINE_CRYSTALS
|
||||||
name: 'Catalyst (Offhand)'
|
name: 'Catalyst (Offhand)'
|
||||||
unident-item:
|
unident-item:
|
||||||
name: '&f#prefix#Unidentified Offhand Catalyst'
|
name: '&f#prefix#Unidentified Catalyst'
|
||||||
lore:
|
lore:
|
||||||
- '&7This item is unidentified. I must'
|
- '&7This item is unidentified. I must'
|
||||||
- '&7find a way to identify it!'
|
- '&7find a way to identify it!'
|
||||||
@ -194,7 +194,7 @@ MAIN_CATALYST:
|
|||||||
display: PRISMARINE_CRYSTALS
|
display: PRISMARINE_CRYSTALS
|
||||||
name: 'Catalyst (Mainhand)'
|
name: 'Catalyst (Mainhand)'
|
||||||
unident-item:
|
unident-item:
|
||||||
name: '&f#prefix#Unidentified Offhand Catalyst'
|
name: '&f#prefix#Unidentified Catalyst'
|
||||||
lore:
|
lore:
|
||||||
- '&7This item is unidentified. I must'
|
- '&7This item is unidentified. I must'
|
||||||
- '&7find a way to identify it!'
|
- '&7find a way to identify it!'
|
||||||
|
Loading…
Reference in New Issue
Block a user