Support for latest ML

This commit is contained in:
Indyuce 2022-01-22 14:42:13 +01:00
parent 5975e4693a
commit 03a9403e33
4 changed files with 7 additions and 21 deletions

View File

@ -141,7 +141,7 @@
<dependency>
<groupId>io.lumine</groupId>
<artifactId>MythicLib-dist</artifactId>
<version>1.3-R20-SNAPSHOT</version>
<version>1.3-R21-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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()) {