From 0e6131b7e6defbf3fc439250b24750d55fa98a9c Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 15 Jan 2022 18:34:54 +0100 Subject: [PATCH] !support for player mods --- pom.xml | 2 +- .../java/net/Indyuce/mmocore/MMOCore.java | 5 +- .../player/attribute/AttributeModifier.java | 122 ++++++++++++++++++ .../api/player/attribute/PlayerAttribute.java | 14 +- .../player/attribute/PlayerAttributes.java | 59 +++++---- .../mmocore/api/player/social/Party.java | 5 +- .../mmocore/api/player/stats/PlayerStats.java | 10 +- .../Indyuce/mmocore/gui/AttributeView.java | 6 +- .../net/Indyuce/mmocore/gui/PlayerStats.java | 5 +- .../mmocore/manager/social/PartyManager.java | 16 +-- .../net/Indyuce/mmocore/skill/ClassSkill.java | 4 +- .../Indyuce/mmocore/skill/list/Ambers.java | 4 +- .../mmocore/skill/list/Neptune_Gift.java | 4 +- .../mmocore/skill/list/Sneaky_Picky.java | 4 +- 14 files changed, 189 insertions(+), 71 deletions(-) create mode 100644 src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java diff --git a/pom.xml b/pom.xml index 842ec39a..5aedb503 100644 --- a/pom.xml +++ b/pom.xml @@ -125,7 +125,7 @@ io.lumine MythicLib-dist - 1.3-R11 + 1.3 provided diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index cfb2e9df..d9b9e244 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -89,7 +89,7 @@ public class MMOCore extends LuminePlugin { public boolean shouldDebugSQL = false; - private static final int MYTHICLIB_COMPATIBILITY_INDEX = 2; + private static final int MYTHICLIB_COMPATIBILITY_INDEX = 3; public MMOCore() { plugin = this; @@ -350,7 +350,8 @@ public class MMOCore extends LuminePlugin { configManager = new ConfigManager(); - //MythicLib.plugin.getSkills().initialize(clearBefore); + if (clearBefore) + MythicLib.plugin.getSkills().initialize(true); skillManager.initialize(clearBefore); mineManager.initialize(clearBefore); partyManager.initialize(clearBefore); diff --git a/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java b/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java new file mode 100644 index 00000000..4c87bf9a --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java @@ -0,0 +1,122 @@ +package net.Indyuce.mmocore.api.player.attribute; + +import io.lumine.mythic.lib.MythicLib; +import io.lumine.mythic.lib.api.player.EquipmentSlot; +import io.lumine.mythic.lib.api.player.MMOPlayerData; +import io.lumine.mythic.lib.api.stat.modifier.StatModifier; +import io.lumine.mythic.lib.player.modifier.ModifierSource; +import io.lumine.mythic.lib.player.modifier.ModifierType; +import io.lumine.mythic.lib.player.modifier.PlayerModifier; +import io.lumine.mythic.lib.util.configobject.ConfigObject; +import net.Indyuce.mmocore.api.player.PlayerData; +import org.apache.commons.lang.Validate; + +import java.text.DecimalFormat; + +public class AttributeModifier extends PlayerModifier { + private final String attribute; + private final double value; + private final ModifierType type; + + private static final DecimalFormat oneDigit = MythicLib.plugin.getMMOConfig().newDecimalFormat("0.#"); + + /** + * Flat attribute modifier (simplest modifier you can think about) + */ + public AttributeModifier(String key, String attribute, double value) { + this(key, attribute, value, ModifierType.FLAT, EquipmentSlot.OTHER, ModifierSource.OTHER); + } + + /** + * Attribute modifier given by an external mecanic, like a party buff, item set bonuses, + * skills or abilities... Anything apart from items and armor. + */ + public AttributeModifier(String key, String attribute, double value, ModifierType type) { + this(key, attribute, value, type, EquipmentSlot.OTHER, ModifierSource.OTHER); + } + + /** + * Attribute modifier given by an item, either a weapon or an armor piece. + * + * @param key Player modifier key + * @param attribute Attribute being modified + * @param value Value of stat modifier + * @param type Is the modifier flat or multiplicative + * @param slot Slot of the item granting the stat modifier + * @param source Type of the item granting the stat modifier + */ + public AttributeModifier(String key, String attribute, double value, ModifierType type, EquipmentSlot slot, ModifierSource source) { + super(key, slot, source); + + this.attribute = attribute; + this.value = value; + this.type = type; + } + + /** + * Used to parse a StatModifier from a string in a configuration section. + * Always returns a modifier with source OTHER. Can be used by MythicCore + * to handle party buffs, or MMOItems for item set bonuses. Throws IAE + * + * @param str The string to be parsed + */ + public AttributeModifier(String key, String attribute, String str) { + super(key, EquipmentSlot.OTHER, ModifierSource.OTHER); + + Validate.notNull(str, "String cannot be null"); + Validate.notEmpty(str, "String cannot be empty"); + + type = str.toCharArray()[str.length() - 1] == '%' ? io.lumine.mythic.lib.player.modifier.ModifierType.RELATIVE : io.lumine.mythic.lib.player.modifier.ModifierType.FLAT; + value = Double.parseDouble(type == io.lumine.mythic.lib.player.modifier.ModifierType.RELATIVE ? str.substring(0, str.length() - 1) : str); + this.attribute = attribute; + } + + public AttributeModifier(ConfigObject object) { + super(object.getString("key"), EquipmentSlot.OTHER, ModifierSource.OTHER); + + this.attribute = object.getString("attribute"); + this.value = object.getDouble("value"); + type = object.getBoolean("multiplicative", false) ? io.lumine.mythic.lib.player.modifier.ModifierType.RELATIVE : io.lumine.mythic.lib.player.modifier.ModifierType.FLAT; + } + + public String getAttribute() { + return attribute; + } + + public ModifierType getType() { + return type; + } + + public double getValue() { + return value; + } + + /** + * Used to multiply some existing stat modifier by a constant, usually an + * integer, for instance when MMOCore party modifiers scale with the + * number of the party member count + * + * @param coef The multiplicative constant + * @return A new instance of StatModifier with modified value + */ + public StatModifier multiply(double coef) { + return new StatModifier(getKey(), attribute, value * coef, type, getSlot(), getSource()); + } + + @Override + public void register(MMOPlayerData mmoPlayerData) { + PlayerData playerData = PlayerData.get(mmoPlayerData.getUniqueId()); + playerData.getAttributes().getInstance(attribute).addModifier(this); + } + + @Override + public void unregister(MMOPlayerData mmoPlayerData) { + PlayerData playerData = PlayerData.get(mmoPlayerData.getUniqueId()); + playerData.getAttributes().getInstance(attribute).removeModifier(getKey()); + } + + @Override + public String toString() { + return oneDigit.format(value) + (type == io.lumine.mythic.lib.player.modifier.ModifierType.RELATIVE ? "%" : ""); + } +} \ No newline at end of file diff --git a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java index 5650fdad..8f714bf7 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java @@ -6,19 +6,19 @@ import net.Indyuce.mmocore.MMOCore; import org.apache.commons.lang.Validate; import org.bukkit.configuration.ConfigurationSection; -import java.util.HashMap; -import java.util.Map; +import java.util.HashSet; +import java.util.Set; import java.util.logging.Level; public class PlayerAttribute { private final String id, name; private final int max; - /* - * used to store stats using StatType, but attributes also need to access + /** + * Used to store stats using StatType, but attributes also need to access * non basic MMOCore stats hence the string maps keys */ - private final Map buffs = new HashMap<>(); + private final Set buffs = new HashSet<>(); public PlayerAttribute(ConfigurationSection config) { Validate.notNull(config, "Could not load config"); @@ -31,7 +31,7 @@ public class PlayerAttribute { for (String key : config.getConfigurationSection("buff").getKeys(false)) try { String stat = key.toUpperCase().replace("-", "_").replace(" ", "_"); - buffs.put(stat, new StatModifier(config.getString("buff." + key))); + buffs.add(new StatModifier("attribute." + id, stat, config.getString("buff." + key))); } catch (IllegalArgumentException exception) { MMOCore.log(Level.WARNING, "Could not load buff '" + key + "' from attribute '" + id + "': " + exception.getMessage()); } @@ -53,7 +53,7 @@ public class PlayerAttribute { return max; } - public Map getBuffs() { + public Set getBuffs() { return buffs; } } diff --git a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java index eb1c73a4..2569d811 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java @@ -3,9 +3,10 @@ package net.Indyuce.mmocore.api.player.attribute; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import io.lumine.mythic.lib.api.stat.modifier.Closable; -import io.lumine.mythic.lib.api.stat.modifier.ModifierType; -import io.lumine.mythic.lib.api.stat.modifier.StatModifier; +import io.lumine.mythic.lib.api.player.EquipmentSlot; +import io.lumine.mythic.lib.player.modifier.Closeable; +import io.lumine.mythic.lib.player.modifier.ModifierSource; +import io.lumine.mythic.lib.player.modifier.ModifierType; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; @@ -33,7 +34,7 @@ public class PlayerAttributes { Validate.isTrue(MMOCore.plugin.attributeManager.has(id), "Could not find attribute '" + id + "'"); PlayerAttribute attribute = MMOCore.plugin.attributeManager.get(id); - AttributeInstance ins = new AttributeInstance(attribute); + AttributeInstance ins = new AttributeInstance(attribute.getId()); ins.setBase(config.getInt(key)); instances.put(id, ins); } catch (IllegalArgumentException exception) { @@ -61,7 +62,7 @@ public class PlayerAttributes { Validate.isTrue(MMOCore.plugin.attributeManager.has(id), "Could not find attribute '" + id + "'"); PlayerAttribute attribute = MMOCore.plugin.attributeManager.get(id); - AttributeInstance ins = new AttributeInstance(attribute); + AttributeInstance ins = new AttributeInstance(attribute.getId()); ins.setBase(entry.getValue().getAsInt()); instances.put(id, ins); } catch (IllegalArgumentException exception) { @@ -88,15 +89,19 @@ public class PlayerAttributes { return map; } - public AttributeInstance getInstance(PlayerAttribute attribute) { - if (instances.containsKey(attribute.getId())) - return instances.get(attribute.getId()); + public AttributeInstance getInstance(String attribute) { + if (instances.containsKey(attribute)) + return instances.get(attribute); AttributeInstance ins = new AttributeInstance(attribute); - instances.put(attribute.getId(), ins); + instances.put(attribute, ins); return ins; } + public AttributeInstance getInstance(PlayerAttribute attribute) { + return getInstance(attribute.getId()); + } + public int countSkillPoints() { int n = 0; for (AttributeInstance ins : instances.values()) @@ -108,10 +113,10 @@ public class PlayerAttributes { private int spent; private final String id; - private final Map map = new HashMap<>(); + private final Map map = new HashMap<>(); - public AttributeInstance(PlayerAttribute attribute) { - id = attribute.getId(); + public AttributeInstance(String attribute) { + id = attribute; } public int getBase() { @@ -138,11 +143,11 @@ public class PlayerAttributes { public int getTotal() { double d = spent; - for (StatModifier attr : map.values()) + for (AttributeModifier attr : map.values()) if (attr.getType() == ModifierType.FLAT) d += attr.getValue(); - for (StatModifier attr : map.values()) + for (AttributeModifier attr : map.values()) if (attr.getType() == ModifierType.RELATIVE) d *= attr.getValue(); @@ -150,16 +155,16 @@ public class PlayerAttributes { return (int) d; } - public StatModifier getModifier(String key) { + public AttributeModifier getModifier(String key) { return map.get(key); } public void addModifier(String key, double value) { - addModifier(key, new StatModifier(value)); + addModifier(new AttributeModifier(key, id, value, ModifierType.FLAT, EquipmentSlot.OTHER, ModifierSource.OTHER)); } - public void addModifier(String key, StatModifier modifier) { - map.put(key, modifier); + public void addModifier(AttributeModifier modifier) { + map.put(modifier.getKey(), modifier); update(); } @@ -172,27 +177,25 @@ public class PlayerAttributes { return map.containsKey(key); } - public void remove(String key) { + public void removeModifier(String key) { + AttributeModifier mod = map.remove(key); /* - * closing stat is really important with temporary stats because + * Closing stat is really important with temporary stats because * otherwise the runnable will try to remove the key from the map * even though the attribute was cancelled before hand */ - StatModifier mod; - if (map.containsKey(key) && (mod = map.get(key)) instanceof Closable) { - ((Closable) mod).close(); - map.remove(key); + if (mod != null) { + if (mod instanceof Closeable) + ((Closeable) mod).close(); + update(); } - - update(); } public void update() { PlayerAttribute attribute = MMOCore.plugin.attributeManager.get(id); int total = getTotal(); - attribute.getBuffs() - .forEach((key, buff) -> data.getStats().getInstance(key).addModifier("attribute." + attribute.getId(), buff.multiply(total))); + attribute.getBuffs().forEach(buff -> buff.multiply(total).register(data.getMMOPlayerData())); } public String getId() { diff --git a/src/main/java/net/Indyuce/mmocore/api/player/social/Party.java b/src/main/java/net/Indyuce/mmocore/api/player/social/Party.java index c5f355d2..473f6a72 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/social/Party.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/social/Party.java @@ -151,12 +151,11 @@ public class Party { } private void applyAttributes(PlayerData player) { - MMOCore.plugin.partyManager.getBonuses().forEach(stat -> player.getStats().getInstance(stat).addModifier("mmocoreParty", - MMOCore.plugin.partyManager.getBonus(stat).multiply(members.size() - 1))); + MMOCore.plugin.partyManager.getBonuses().forEach(buff -> buff.multiply(members.size() - 1).register(player.getMMOPlayerData())); } private void clearAttributes(PlayerData player) { - MMOCore.plugin.partyManager.getBonuses().forEach(stat -> player.getStats().getInstance(stat).remove("mmocoreParty")); + MMOCore.plugin.partyManager.getBonuses().forEach(buff -> player.getStats().getInstance(buff.getStat()).remove("mmocoreParty")); } } } diff --git a/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java b/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java index 594f1a9e..2aa6a2c9 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java @@ -3,9 +3,9 @@ package net.Indyuce.mmocore.api.player.stats; import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.api.stat.StatInstance; import io.lumine.mythic.lib.api.stat.StatMap; -import io.lumine.mythic.lib.api.stat.modifier.ModifierSource; -import io.lumine.mythic.lib.api.stat.modifier.ModifierType; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; +import io.lumine.mythic.lib.player.modifier.ModifierSource; +import io.lumine.mythic.lib.player.modifier.ModifierType; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.skill.ClassSkill; @@ -67,7 +67,7 @@ public class PlayerStats { // Add newest one double total = getBase(stat) - instance.getBase(); if (total != 0) - packet.addModifier("mmocoreClass", new StatModifier(total, ModifierType.FLAT, EquipmentSlot.OTHER, ModifierSource.OTHER)); + packet.addModifier(new StatModifier("mmocoreClass", stat.name(), total, ModifierType.FLAT, EquipmentSlot.OTHER, ModifierSource.OTHER)); // Then update the stat packet.runUpdate(); @@ -80,9 +80,9 @@ public class PlayerStats { * * This updates the player's passive skills */ - data.getMMOPlayerData().unregisterSkillTriggers("MMOCorePassiveSkill"); + data.getMMOPlayerData().getPassiveSkillMap().removeModifiers("MMOCorePassiveSkill"); for (ClassSkill skill : data.getProfess().getSkills()) if (skill.getSkill().hasTrigger()) - data.getMMOPlayerData().registerSkillTrigger(skill.toPassive(data)); + data.getMMOPlayerData().getPassiveSkillMap().addModifier(skill.toPassive(data)); } } diff --git a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java index d7a7bf56..fb2348c3 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java @@ -64,9 +64,9 @@ public class AttributeView extends EditableInventory { holders.register("max", attribute.getMax()); holders.register("current", total); holders.register("attribute_points", inv.getPlayerData().getAttributePoints()); - attribute.getBuffs().forEach((key, buff) -> { - holders.register("buff_" + key.toLowerCase(), buff); - holders.register("total_" + key.toLowerCase(), buff.multiply(total)); + attribute.getBuffs().forEach(buff -> { + holders.register("buff_" + buff.getStat().toLowerCase(), buff.getValue()); + holders.register("total_" + buff.getStat().toLowerCase(), buff.multiply(total).getValue()); }); return holders; } diff --git a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java index 52582271..f89da01b 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java +++ b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.gui; +import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import io.lumine.mythic.lib.version.VersionMaterial; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.experience.Booster; @@ -178,8 +179,8 @@ public class PlayerStats extends EditableInventory { int count = inv.getPlayerData().getParty().getMembers().count(); holders.register("count", "" + count); - for (StatType stat : MMOCore.plugin.partyManager.getBonuses()) - holders.register("buff_" + stat.name().toLowerCase(), MMOCore.plugin.partyManager.getBonus(stat).multiply(count - 1).toString()); + for (StatModifier buff : MMOCore.plugin.partyManager.getBonuses()) + holders.register("buff_" + buff.getStat().toLowerCase(), buff.multiply(count - 1).toString()); return holders; } diff --git a/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java b/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java index 40104745..3662997c 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java @@ -16,7 +16,7 @@ import java.util.logging.Level; public class PartyManager implements MMOCoreManager { private final Set parties = new HashSet<>(); - private final Map buffs = new HashMap<>(); + private final Set buffs = new HashSet<>(); public void registerParty(Party party) { parties.add(party); @@ -38,16 +38,8 @@ public class PartyManager implements MMOCoreManager { parties.remove(party); } - public boolean hasBonus(StatType stat) { - return buffs.containsKey(stat); - } - - public StatModifier getBonus(StatType stat) { - return buffs.get(stat); - } - - public Set getBonuses() { - return buffs.keySet(); + public Set getBonuses() { + return buffs; } @Override @@ -60,7 +52,7 @@ public class PartyManager implements MMOCoreManager { for (String key : config.getKeys(false)) try { StatType stat = StatType.valueOf(key.toUpperCase().replace("-", "_").replace(" ", "_")); - buffs.put(stat, new StatModifier(config.getString(key))); + buffs.add(new StatModifier("mmocoreParty", stat.name(), config.getString(key))); } catch (IllegalArgumentException exception) { MMOCore.log(Level.WARNING, "Could not load party buff '" + key + "': " + exception.getMessage()); } diff --git a/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java b/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java index 44f02353..3a799234 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java +++ b/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java @@ -1,9 +1,9 @@ package net.Indyuce.mmocore.skill; import io.lumine.mythic.lib.api.player.EquipmentSlot; -import io.lumine.mythic.lib.api.stat.modifier.ModifierSource; import io.lumine.mythic.lib.player.cooldown.CooldownObject; -import io.lumine.mythic.lib.skill.trigger.PassiveSkill; +import io.lumine.mythic.lib.player.modifier.ModifierSource; +import io.lumine.mythic.lib.player.skill.PassiveSkill; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.math.formula.IntegerLinearValue; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; diff --git a/src/main/java/net/Indyuce/mmocore/skill/list/Ambers.java b/src/main/java/net/Indyuce/mmocore/skill/list/Ambers.java index b3629fd7..9aa16347 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/list/Ambers.java +++ b/src/main/java/net/Indyuce/mmocore/skill/list/Ambers.java @@ -4,10 +4,10 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.event.PlayerAttackEvent; import io.lumine.mythic.lib.api.player.MMOPlayerData; import io.lumine.mythic.lib.damage.DamageType; +import io.lumine.mythic.lib.player.skill.PassiveSkill; import io.lumine.mythic.lib.skill.SkillMetadata; import io.lumine.mythic.lib.skill.handler.SkillHandler; import io.lumine.mythic.lib.skill.result.def.SimpleSkillResult; -import io.lumine.mythic.lib.skill.trigger.PassiveSkill; import io.lumine.mythic.lib.skill.trigger.TriggerMetadata; import io.lumine.mythic.lib.util.EntityLocationType; import io.lumine.mythic.lib.util.ParabolicProjectile; @@ -49,7 +49,7 @@ public class Ambers extends SkillHandler implements Listener if (!event.getAttack().getDamage().hasType(DamageType.SKILL)) return; - PassiveSkill passive = data.getPassiveSkill(this); + PassiveSkill passive = data.getPassiveSkillMap().getSkill(this); if (passive == null) return; diff --git a/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java b/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java index 89c084ee..bf45e0f4 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java +++ b/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java @@ -1,9 +1,9 @@ package net.Indyuce.mmocore.skill.list; +import io.lumine.mythic.lib.player.skill.PassiveSkill; import io.lumine.mythic.lib.skill.SkillMetadata; import io.lumine.mythic.lib.skill.handler.SkillHandler; import io.lumine.mythic.lib.skill.result.def.SimpleSkillResult; -import io.lumine.mythic.lib.skill.trigger.PassiveSkill; import net.Indyuce.mmocore.api.event.PlayerResourceUpdateEvent; import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Material; @@ -31,7 +31,7 @@ public class Neptune_Gift extends SkillHandler implements Lis public void a(PlayerResourceUpdateEvent event) { PlayerData data = event.getData(); if (event.getPlayer().getLocation().getBlock().getType() == Material.WATER) { - PassiveSkill skill = event.getData().getMMOPlayerData().getPassiveSkill(this); + PassiveSkill skill = event.getData().getMMOPlayerData().getPassiveSkillMap().getSkill(this); if (skill == null) return; diff --git a/src/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java b/src/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java index afde9eb3..266d1f52 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java +++ b/src/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java @@ -3,10 +3,10 @@ package net.Indyuce.mmocore.skill.list; import io.lumine.mythic.lib.api.event.PlayerAttackEvent; import io.lumine.mythic.lib.api.player.MMOPlayerData; import io.lumine.mythic.lib.damage.DamageType; +import io.lumine.mythic.lib.player.skill.PassiveSkill; import io.lumine.mythic.lib.skill.SkillMetadata; import io.lumine.mythic.lib.skill.handler.SkillHandler; import io.lumine.mythic.lib.skill.result.def.SimpleSkillResult; -import io.lumine.mythic.lib.skill.trigger.PassiveSkill; import io.lumine.mythic.lib.skill.trigger.TriggerMetadata; import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Particle; @@ -41,7 +41,7 @@ public class Sneaky_Picky extends SkillHandler implements Lis if (!event.getAttack().getDamage().hasType(DamageType.WEAPON) || PlayerData.get(data.getUniqueId()).isInCombat()) return; - PassiveSkill skill = data.getPassiveSkill(this); + PassiveSkill skill = data.getPassiveSkillMap().getSkill(this); if (skill == null) return;