Fixed staffs and whips dealing no damage

This commit is contained in:
Indyuce 2021-10-03 12:08:39 +02:00
parent f5e55c01a4
commit af8c81e8a9
6 changed files with 6 additions and 6 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.Indyuce</groupId>
<artifactId>MMOItems</artifactId>
<version>6.6.1</version>
<version>6.6.2</version>
<name>MMOItems</name>
<description>A great item solution for your RPG server!!</description>

View File

@ -41,7 +41,7 @@ public class ItemAttackMetadata extends AttackMetadata {
}
/**
* Applies all necessary on-hit effects for any type of damage.
* Applies all necessary weapon on-hit effects for any type of damage.
* Makes things much easier for untargeted weapons like staffs
*
* @param item The item being used

View File

@ -49,7 +49,7 @@ public class Whip extends UntargetedWeapon {
MMORayTraceResult trace = MythicLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), range,
entity -> MMOUtils.canTarget(stats.getPlayer(), entity, InteractionType.OFFENSE_ACTION));
if (trace.hasHit())
new ItemAttackMetadata(new DamageMetadata(attackDamage, DamageType.WEAPON, DamageType.PROJECTILE, DamageType.PHYSICAL), stats).applyEffects(getNBTItem(), trace.getHit());
new ItemAttackMetadata(new DamageMetadata(attackDamage, DamageType.WEAPON, DamageType.PROJECTILE, DamageType.PHYSICAL), stats).applyEffectsAndDamage(getNBTItem(), trace.getHit());
trace.draw(loc, getPlayer().getEyeLocation().getDirection(), 2,
(tick) -> tick.getWorld().spawnParticle(Particle.CRIT, tick, 0, .1, .1, .1, 0));
getPlayer().getWorld().playSound(getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 2);

View File

@ -20,7 +20,7 @@ public class LightningSpirit implements StaffAttackHandler {
MMORayTraceResult trace = MythicLib.plugin.getVersion().getWrapper().rayTrace(attackMeta.getDamager(), range,
entity -> MMOUtils.canTarget(attackMeta.getDamager(), entity, InteractionType.OFFENSE_ACTION));
if (trace.hasHit())
attackMeta.applyEffects(nbt, trace.getHit());
attackMeta.applyEffectsAndDamage(nbt, trace.getHit());
trace.draw(loc, attackMeta.getDamager().getEyeLocation().getDirection(), 2,
loc1 -> loc1.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc1, 0));
}

View File

@ -47,7 +47,7 @@ public class ManaSpirit implements StaffAttackHandler {
}
for (Entity target : targets)
if (MMOUtils.canTarget(attackMeta.getDamager(), loc, target, InteractionType.OFFENSE_ACTION)) {
attackMeta.applyEffects(nbt, (LivingEntity) target);
attackMeta.applyEffectsAndDamage(nbt, (LivingEntity) target);
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0);
cancel();
return;

View File

@ -39,7 +39,7 @@ public class NetherSpirit implements StaffAttackHandler {
loc.getWorld().spawnParticle(Particle.SMOKE_NORMAL, loc, 0);
for (Entity target : targets)
if (MMOUtils.canTarget(attackMeta.getDamager(), loc, target, InteractionType.OFFENSE_ACTION)) {
attackMeta.applyEffects(nbt, (LivingEntity) target);
attackMeta.applyEffectsAndDamage(nbt, (LivingEntity) target);
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0);
cancel();
return;