From 03a9403e3337d46ac0109af73d14cf7ca00adb5d Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 22 Jan 2022 14:42:13 +0100 Subject: [PATCH] Support for latest ML --- pom.xml | 2 +- .../java/net/Indyuce/mmoitems/MMOItems.java | 2 +- .../java/net/Indyuce/mmoitems/api/TypeSet.java | 6 +++--- .../mmoitems/manager/EntityManager.java | 18 ++---------------- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/pom.xml b/pom.xml index 2e0bc8b4..684814c9 100644 --- a/pom.xml +++ b/pom.xml @@ -141,7 +141,7 @@ io.lumine MythicLib-dist - 1.3-R20-SNAPSHOT + 1.3-R21-SNAPSHOT provided diff --git a/src/main/java/net/Indyuce/mmoitems/MMOItems.java b/src/main/java/net/Indyuce/mmoitems/MMOItems.java index 83bf7ff1..d4a6d9ef 100644 --- a/src/main/java/net/Indyuce/mmoitems/MMOItems.java +++ b/src/main/java/net/Indyuce/mmoitems/MMOItems.java @@ -97,7 +97,7 @@ public class MMOItems extends LuminePlugin { private VaultSupport vaultSupport; private RPGHandler rpgPlugin; - private static final int MYTHICLIB_COMPATIBILITY_INDEX = 3; + private static final int MYTHICLIB_COMPATIBILITY_INDEX = 4; public MMOItems() { plugin = this; diff --git a/src/main/java/net/Indyuce/mmoitems/api/TypeSet.java b/src/main/java/net/Indyuce/mmoitems/api/TypeSet.java index 5ac7ed93..7c13cb88 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/TypeSet.java +++ b/src/main/java/net/Indyuce/mmoitems/api/TypeSet.java @@ -43,7 +43,7 @@ public enum TypeSet { .angle(entity.getLocation().subtract(attack.getPlayer().getLocation()).toVector()) < Math.PI / 3 && MMOUtils.canTarget(attack.getPlayer(), entity, InteractionType.OFFENSE_ACTION) && !entity.equals(target)) { ItemAttackMetadata subAttack = new ItemAttackMetadata(attack.getDamage().clone(), attack); - subAttack.getDamage().multiply(.4); + subAttack.getDamage().multiplicativeModifier(.4); subAttack.applyEffectsAndDamage(weapon.getNBTItem(), (LivingEntity) entity); } }), @@ -72,7 +72,7 @@ public enum TypeSet { .angle(entity.getLocation().toVector().subtract(attack.getPlayer().getLocation().toVector())) < Math.PI / 18 && MMOUtils.canTarget(attack.getPlayer(), entity, InteractionType.OFFENSE_ACTION) && !entity.equals(target)) { ItemAttackMetadata subAttack = new ItemAttackMetadata(attack.getDamage().clone(), attack); - subAttack.getDamage().multiply(.4); + subAttack.getDamage().multiplicativeModifier(.4); subAttack.applyEffectsAndDamage(weapon.getNBTItem(), (LivingEntity) entity); } }), @@ -98,7 +98,7 @@ public enum TypeSet { for (Entity entity : target.getNearbyEntities(bluntPower, bluntPower, bluntPower)) if (MMOUtils.canTarget(attack.getPlayer(), entity, InteractionType.OFFENSE_ACTION) && !entity.equals(target)) { ItemAttackMetadata subAttack = new ItemAttackMetadata(attack.getDamage().clone(), attack); - subAttack.getDamage().multiply(bluntRating); + subAttack.getDamage().multiplicativeModifier(bluntRating); subAttack.applyEffectsAndDamage(weapon.getNBTItem(), (LivingEntity) entity); } } diff --git a/src/main/java/net/Indyuce/mmoitems/manager/EntityManager.java b/src/main/java/net/Indyuce/mmoitems/manager/EntityManager.java index 36af9a6c..17892b5e 100644 --- a/src/main/java/net/Indyuce/mmoitems/manager/EntityManager.java +++ b/src/main/java/net/Indyuce/mmoitems/manager/EntityManager.java @@ -113,21 +113,7 @@ public class EntityManager implements Listener { Bukkit.getScheduler().scheduleSyncDelayedTask(MMOItems.plugin, () -> unregisterCustomEntity(event.getEntity())); } - /* - * Projectile Damage and Effects - * - * TODO - * When throwing a trident, on hit abilities dont cast half - * of the time because you don't hold the item anymore, therefore - * the ability does not register. - * To fix that, not only cache the player statistics using CachedStats - * but also the player abilities as well as elemental stats. In fact - * a lot of extra stats need to be cached when a ranged attack is delivered. - * - * TODO - * This bug could also be exploited using a bow, by holding another item - * after shooting an arrow!! - */ + // Projectile damage and effects @EventHandler(ignoreCancelled = true) public void b(EntityDamageByEntityEvent event) { if (!(event.getDamager() instanceof Projectile) || !(event.getEntity() instanceof LivingEntity) || event.getEntity().hasMetadata("NPC")) @@ -143,7 +129,7 @@ public class EntityManager implements Listener { // Apply power vanilla enchant if (projectile instanceof Arrow && data.getSourceItem().getItem().hasItemMeta() && data.getSourceItem().getItem().getItemMeta().getEnchants().containsKey(Enchantment.ARROW_DAMAGE)) - data.getAttackMetadata().getDamage().multiply(1.25 + (.25 * data.getSourceItem().getItem().getItemMeta().getEnchantLevel(Enchantment.ARROW_DAMAGE)), DamageType.WEAPON); + data.getAttackMetadata().getDamage().multiplicativeModifier(1.25 + (.25 * data.getSourceItem().getItem().getItemMeta().getEnchantLevel(Enchantment.ARROW_DAMAGE)), DamageType.WEAPON); // Apply MMOItems specific modifications if (data.isCustomWeapon()) {