diff --git a/lib/MMOCore.jar b/lib/MMOCore.jar index eb9432d6..65e6be90 100644 Binary files a/lib/MMOCore.jar and b/lib/MMOCore.jar differ diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Bouncy_Fireball.java b/src/main/java/net/Indyuce/mmoitems/ability/Bouncy_Fireball.java index 7bb956d2..af3a884b 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Bouncy_Fireball.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Bouncy_Fireball.java @@ -12,8 +12,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Bouncy_Fireball extends Ability { @@ -74,7 +74,7 @@ public class Bouncy_Fireball extends Ability { for (Entity entity : MMOUtils.getNearbyChunkEntities(loc)) if (entity.getLocation().distanceSquared(loc) < radius * radius) if (MMOUtils.canDamage(stats.getPlayer(), entity)) { - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage, DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); ((LivingEntity) entity).setFireTicks((int) (ignite * 20)); } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Burning_Hands.java b/src/main/java/net/Indyuce/mmoitems/ability/Burning_Hands.java index 92bef2fb..ac5194b7 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Burning_Hands.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Burning_Hands.java @@ -13,8 +13,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Burning_Hands extends Ability implements Listener { @@ -58,7 +58,7 @@ public class Burning_Hands extends Ability implements Listener { if (entity.getLocation().distanceSquared(loc) < 60) if (stats.getPlayer().getEyeLocation().getDirection().angle(entity.getLocation().toVector().subtract(stats.getPlayer().getLocation().toVector())) < Math.PI / 6) if (MMOUtils.canDamage(stats.getPlayer(), entity)) - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.MAGICAL); } }.runTaskTimer(MMOItems.plugin, 0, 2); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Circular_Slash.java b/src/main/java/net/Indyuce/mmoitems/ability/Circular_Slash.java index c98239f7..c062d701 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Circular_Slash.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Circular_Slash.java @@ -13,8 +13,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Circular_Slash extends Ability { @@ -39,7 +39,7 @@ public class Circular_Slash extends Ability { stats.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 2, 254)); for (Entity entity : stats.getPlayer().getNearbyEntities(radius, radius, radius)) { if (MMOUtils.canDamage(stats.getPlayer(), entity)) { - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.PHYSICAL); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.PHYSICAL); Vector v1 = entity.getLocation().toVector(); Vector v2 = stats.getPlayer().getLocation().toVector(); double y = .5; diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Contamination.java b/src/main/java/net/Indyuce/mmoitems/ability/Contamination.java index 500044d7..5fdd4072 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Contamination.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Contamination.java @@ -11,8 +11,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -60,7 +60,7 @@ public class Contamination extends Ability { loc.getWorld().playSound(loc, VersionSound.ENTITY_ENDERMAN_HURT.toSound(), 2, 1); for (Entity entity : MMOUtils.getNearbyChunkEntities(loc)) if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) <= 25) - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, dps, DamageType.MAGIC, false); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, dps, false, DamageType.SKILL, DamageType.MAGICAL); } } }.runTaskTimer(MMOItems.plugin, 0, 1); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Corrupt.java b/src/main/java/net/Indyuce/mmoitems/ability/Corrupt.java index c68ebb30..09cd728d 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Corrupt.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Corrupt.java @@ -12,8 +12,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -53,7 +53,7 @@ public class Corrupt extends Ability { for (Entity entity : MMOUtils.getNearbyChunkEntities(loc)) if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) <= radius * radius) { - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.MAGICAL); ((LivingEntity) entity).removePotionEffect(PotionEffectType.WITHER); ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.WITHER, (int) (duration * 20), (int) amplifier)); } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Corrupted_Fangs.java b/src/main/java/net/Indyuce/mmoitems/ability/Corrupted_Fangs.java index 6f2859be..f2eb115d 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Corrupted_Fangs.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Corrupted_Fangs.java @@ -15,8 +15,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Corrupted_Fangs extends Ability implements Listener { @@ -63,7 +63,7 @@ public class Corrupted_Fangs extends Ability implements Listener { Object[] data = MMOItems.plugin.getEntities().getEntityData(damager); TemporaryStats stats = (TemporaryStats) data[0]; if (MMOUtils.canDamage(stats.getPlayer(), event.getEntity())) - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) event.getEntity(), (double) data[1], DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) event.getEntity(), (double) data[1], DamageType.SKILL, DamageType.MAGICAL); } } } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Cursed_Beam.java b/src/main/java/net/Indyuce/mmoitems/ability/Cursed_Beam.java index 77fdbacd..6931e210 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Cursed_Beam.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Cursed_Beam.java @@ -16,8 +16,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -66,7 +66,7 @@ public class Cursed_Beam extends Ability { for (Entity aoeTarget : entities) if (MMOUtils.canDamage(stats.getPlayer(), aoeTarget) && loc.distanceSquared(aoeTarget.getLocation().add(0, 1, 0)) < 9) { - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) aoeTarget, damage, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) aoeTarget, damage, DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); ((LivingEntity) aoeTarget).addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, (int) (duration * 20), 0)); } cancel(); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Earthquake.java b/src/main/java/net/Indyuce/mmoitems/ability/Earthquake.java index 12c05374..25a0793d 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Earthquake.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Earthquake.java @@ -17,8 +17,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Earthquake extends Ability { @@ -62,7 +62,7 @@ public class Earthquake extends Ability { for (Entity entity : MMOUtils.getNearbyChunkEntities(loc)) if (MMOUtils.canDamage(stats.getPlayer(), entity) && loc.distanceSquared(entity.getLocation()) < 2 && !hit.contains(entity.getEntityId())) { hit.add(entity.getEntityId()); - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.MAGICAL); ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier)); } } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Explosive_Turkey.java b/src/main/java/net/Indyuce/mmoitems/ability/Explosive_Turkey.java index b84e0d41..42f6c91b 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Explosive_Turkey.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Explosive_Turkey.java @@ -13,8 +13,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Explosive_Turkey extends Ability { @@ -71,7 +71,7 @@ public class Explosive_Turkey extends Ability { chicken.getWorld().playSound(chicken.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 2, 1.5f); for (Entity entity : MMOUtils.getNearbyChunkEntities(chicken.getLocation())) if (!entity.isDead() && entity.getLocation().distanceSquared(chicken.getLocation()) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity)) { - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); entity.setVelocity(entity.getLocation().toVector().subtract(chicken.getLocation().toVector()).multiply(.1 * knockback).setY(.4 * knockback)); } cancel(); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Fire_Meteor.java b/src/main/java/net/Indyuce/mmoitems/ability/Fire_Meteor.java index cc0800d5..20de5e60 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Fire_Meteor.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Fire_Meteor.java @@ -13,8 +13,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -57,7 +57,7 @@ public class Fire_Meteor extends Ability { double radius = data.getModifier("radius"); for (Entity entity : loc.getWorld().getEntitiesByClass(LivingEntity.class)) if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) < radius * radius) { - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); entity.setVelocity(entity.getLocation().toVector().subtract(loc.toVector()).multiply(.1 * knockback).setY(.4 * knockback)); } cancel(); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Firebolt.java b/src/main/java/net/Indyuce/mmoitems/ability/Firebolt.java index 377f6a1c..2c836d34 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Firebolt.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Firebolt.java @@ -14,8 +14,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -59,7 +59,7 @@ public class Firebolt extends Ability { loc.getWorld().spawnParticle(Particle.LAVA, loc, 8, 0, 0, 0, 0); loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0); loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 3, 1); - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) target, data.getModifier("damage"), DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) target, data.getModifier("damage"), DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); target.setFireTicks((int) data.getModifier("ignite") * 20); cancel(); return; diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Firefly.java b/src/main/java/net/Indyuce/mmoitems/ability/Firefly.java index 48f32a52..1f6fdac3 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Firefly.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Firefly.java @@ -13,8 +13,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -62,7 +62,7 @@ public class Firefly extends Ability { stats.getPlayer().getWorld().spawnParticle(Particle.FLAME, stats.getPlayer().getLocation().add(0, 1, 0), 24, 0, 0, 0, .3); entity.setVelocity(stats.getPlayer().getVelocity().setY(0.3).multiply(1.7 * knockback)); stats.getPlayer().setVelocity(stats.getPlayer().getEyeLocation().getDirection().multiply(-3).setY(.5)); - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage, DamageType.SKILL, DamageType.MAGICAL); cancel(); return; } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Freezing_Curse.java b/src/main/java/net/Indyuce/mmoitems/ability/Freezing_Curse.java index f0fda429..b5bbe8cc 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Freezing_Curse.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Freezing_Curse.java @@ -13,8 +13,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -65,7 +65,7 @@ public class Freezing_Curse extends Ability { double damage = data.getModifier("damage"); for (Entity entity : MMOUtils.getNearbyChunkEntities(loc)) if (entity.getLocation().distanceSquared(loc) < radius * radius && MMOUtils.canDamage(stats.getPlayer(), entity)) { - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage, DamageType.SKILL, DamageType.MAGICAL); ((LivingEntity) entity).removePotionEffect(PotionEffectType.SLOW); ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (duration * 20), (int) amplifier)); } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Heavy_Charge.java b/src/main/java/net/Indyuce/mmoitems/ability/Heavy_Charge.java index 83a7109c..5a921d19 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Heavy_Charge.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Heavy_Charge.java @@ -11,8 +11,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Heavy_Charge extends Ability { @@ -50,7 +50,7 @@ public class Heavy_Charge extends Ability { stats.getPlayer().getWorld().spawnParticle(Particle.EXPLOSION_LARGE, target.getLocation().add(0, 1, 0), 0); target.setVelocity(stats.getPlayer().getVelocity().setY(0.3).multiply(1.7 * knockback)); stats.getPlayer().setVelocity(stats.getPlayer().getVelocity().setX(0).setY(0).setZ(0)); - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) target, data.getModifier("damage"), DamageType.PHYSICAL); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) target, data.getModifier("damage"), DamageType.SKILL, DamageType.PHYSICAL); cancel(); break; } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Holy_Missile.java b/src/main/java/net/Indyuce/mmoitems/ability/Holy_Missile.java index ff149676..4b463137 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Holy_Missile.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Holy_Missile.java @@ -14,8 +14,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -59,7 +59,7 @@ public class Holy_Missile extends Ability { loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 1); loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 32, 0, 0, 0, .2); loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 2, 1); - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, data.getModifier("damage"), DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, data.getModifier("damage"), DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); cancel(); return; } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Ice_Crystal.java b/src/main/java/net/Indyuce/mmoitems/ability/Ice_Crystal.java index fe0560f5..e183dfef 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Ice_Crystal.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Ice_Crystal.java @@ -17,8 +17,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -72,7 +72,7 @@ public class Ice_Crystal extends Ability { loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0); loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 48, 0, 0, 0, .2); loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 2, 1); - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, data.getModifier("damage"), DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, data.getModifier("damage"), DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (data.getModifier("duration") * 20), (int) data.getModifier("amplifier"))); cancel(); return; diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Item_Bomb.java b/src/main/java/net/Indyuce/mmoitems/ability/Item_Bomb.java index 6bd676a1..a577de59 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Item_Bomb.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Item_Bomb.java @@ -15,9 +15,9 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; import net.Indyuce.mmoitems.api.util.NoInteractItemEntity; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -59,7 +59,7 @@ public class Item_Bomb extends Ability implements Listener { for (Entity entity : item.getEntity().getNearbyEntities(radius, radius, radius)) if (MMOUtils.canDamage(stats.getPlayer(), entity)) { LivingEntity living = (LivingEntity) entity; - MMOItems.plugin.getDamage().damage(stats, living, damage, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, living, damage, DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); living.removePotionEffect(PotionEffectType.SLOW); living.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier)); } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Item_Throw.java b/src/main/java/net/Indyuce/mmoitems/ability/Item_Throw.java index c808d082..ac50ccfd 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Item_Throw.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Item_Throw.java @@ -13,9 +13,9 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; import net.Indyuce.mmoitems.api.util.NoInteractItemEntity; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Item_Throw extends Ability implements Listener { @@ -53,7 +53,7 @@ public class Item_Throw extends Ability implements Listener { item.getEntity().getWorld().spawnParticle(Particle.CRIT, item.getEntity().getLocation(), 0); for (Entity target : item.getEntity().getNearbyEntities(1, 1, 1)) if (MMOUtils.canDamage(stats.getPlayer(), target)) { - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) target, data.getModifier("damage"), DamageType.PHYSICAL); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) target, data.getModifier("damage"), DamageType.SKILL, DamageType.PROJECTILE, DamageType.PHYSICAL); item.close(); cancel(); } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Life_Ender.java b/src/main/java/net/Indyuce/mmoitems/ability/Life_Ender.java index 801f022d..3c81bf41 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Life_Ender.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Life_Ender.java @@ -12,8 +12,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -69,7 +69,7 @@ public class Life_Ender extends Ability { for (Entity entity : MMOUtils.getNearbyChunkEntities(source)) if (entity.getLocation().distanceSquared(source) < radius * radius && MMOUtils.canDamage(stats.getPlayer(), entity)) { - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage, DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); entity.setVelocity(entity.getLocation().subtract(source).toVector().setY(.75).normalize().multiply(knockback)); } cancel(); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Light_Dash.java b/src/main/java/net/Indyuce/mmoitems/ability/Light_Dash.java index d38ffd0a..72536a19 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Light_Dash.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Light_Dash.java @@ -13,8 +13,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -49,7 +49,7 @@ public class Light_Dash extends Ability { for (Entity entity : stats.getPlayer().getNearbyEntities(1, 1, 1)) if (!hit.contains(entity.getEntityId()) && MMOUtils.canDamage(stats.getPlayer(), entity)) { hit.add(entity.getEntityId()); - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.PHYSICAL); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.PHYSICAL); } } }.runTaskTimer(MMOItems.plugin, 0, 2); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Lightning_Beam.java b/src/main/java/net/Indyuce/mmoitems/ability/Lightning_Beam.java index 4927199b..142c194f 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Lightning_Beam.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Lightning_Beam.java @@ -10,8 +10,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -41,7 +41,7 @@ public class Lightning_Beam extends Ability { for (Entity entity : MMOUtils.getNearbyChunkEntities(loc)) if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) <= radius * radius) - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.MAGICAL); stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 0); loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 64, 0, 0, 0, .2); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Magma_Fissure.java b/src/main/java/net/Indyuce/mmoitems/ability/Magma_Fissure.java index f209e4b5..1908b170 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Magma_Fissure.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Magma_Fissure.java @@ -10,8 +10,8 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -56,7 +56,7 @@ public class Magma_Fissure extends Ability { if (target.getLocation().distanceSquared(loc) < 1) { loc.getWorld().playSound(loc, Sound.ENTITY_BLAZE_HURT, 2, 1); target.setFireTicks((int) (target.getFireTicks() + data.getModifier("ignite") * 20)); - MMOItems.plugin.getDamage().damage(stats, target, data.getModifier("damage"), DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, target, data.getModifier("damage"), DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); cancel(); } } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Overload.java b/src/main/java/net/Indyuce/mmoitems/ability/Overload.java index 4d7d60c0..220b33bd 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Overload.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Overload.java @@ -12,8 +12,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -39,7 +39,7 @@ public class Overload extends Ability { for (Entity entity : stats.getPlayer().getNearbyEntities(radius, radius, radius)) if (MMOUtils.canDamage(stats.getPlayer(), entity)) - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.MAGICAL); double step = 12 + (radius * 2.5); for (double j = 0; j < Math.PI * 2; j += Math.PI / step) { diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Present_Throw.java b/src/main/java/net/Indyuce/mmoitems/ability/Present_Throw.java index 8347797d..54a89e7a 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Present_Throw.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Present_Throw.java @@ -20,9 +20,9 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; import net.Indyuce.mmoitems.api.util.NoInteractItemEntity; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionMaterial; import net.Indyuce.mmoitems.version.VersionSound; @@ -89,7 +89,7 @@ public class Present_Throw extends Ability { item.getEntity().getWorld().playSound(item.getEntity().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 1.5f); for (Entity entity : MMOUtils.getNearbyChunkEntities(item.getEntity().getLocation())) if (entity.getLocation().distanceSquared(item.getEntity().getLocation()) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity)) - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); item.close(); cancel(); } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Sky_Smash.java b/src/main/java/net/Indyuce/mmoitems/ability/Sky_Smash.java index f8ae580b..285ab16e 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Sky_Smash.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Sky_Smash.java @@ -12,8 +12,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Sky_Smash extends Ability { @@ -40,7 +40,7 @@ public class Sky_Smash extends Ability { for (Entity entity : MMOUtils.getNearbyChunkEntities(loc)) if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) < 10) { - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.PHYSICAL); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.PHYSICAL); Location loc1 = stats.getPlayer().getEyeLocation().clone(); loc1.setPitch(-70); ((LivingEntity) entity).setVelocity(loc1.getDirection().multiply(1.2 * knockUp)); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Smite.java b/src/main/java/net/Indyuce/mmoitems/ability/Smite.java index b69aa949..74b85d7f 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Smite.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Smite.java @@ -5,8 +5,8 @@ import org.bukkit.entity.LivingEntity; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Smite extends Ability { @@ -27,7 +27,7 @@ public class Smite extends Ability { return; } - MMOItems.plugin.getDamage().damage(stats, target, data.getModifier("damage"), DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, target, data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL); target.getWorld().strikeLightningEffect(target.getLocation()); } } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Sparkle.java b/src/main/java/net/Indyuce/mmoitems/ability/Sparkle.java index f9b24e60..17d15f76 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Sparkle.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Sparkle.java @@ -10,8 +10,8 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -39,7 +39,7 @@ public class Sparkle extends Ability { double radius = data.getModifier("radius"); double limit = data.getModifier("limit"); - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) target, damage1, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) target, damage1, DamageType.SKILL, DamageType.MAGICAL); target.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, target.getLocation().add(0, 1, 0), 0); target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 2); int count = 0; @@ -49,7 +49,7 @@ public class Sparkle extends Ability { if (ent instanceof LivingEntity && ent != stats.getPlayer() && !(ent instanceof ArmorStand)) { count++; - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) ent, damage1, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) ent, damage1, DamageType.SKILL, DamageType.MAGICAL); ent.getWorld().playSound(ent.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 2); Location loc_t = target.getLocation().add(0, .75, 0); Location loc_ent = ent.getLocation().add(0, .75, 0); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Tactical_Grenade.java b/src/main/java/net/Indyuce/mmoitems/ability/Tactical_Grenade.java index 0073b30f..076188f4 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Tactical_Grenade.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Tactical_Grenade.java @@ -15,8 +15,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Tactical_Grenade extends Ability { @@ -73,7 +73,7 @@ public class Tactical_Grenade extends Ability { if (entity.equals(target)) cancel(); - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, data.getModifier("damage"), DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, data.getModifier("damage"), DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); entity.setVelocity(entity.getVelocity().add(offsetVector(knockup))); } } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Targeted_Fireball.java b/src/main/java/net/Indyuce/mmoitems/ability/Targeted_Fireball.java index 90d6fa84..d43d3fed 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Targeted_Fireball.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Targeted_Fireball.java @@ -9,8 +9,8 @@ import org.bukkit.scheduler.BukkitRunnable; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -55,7 +55,7 @@ public class Targeted_Fireball extends Ability { loc.getWorld().spawnParticle(Particle.FLAME, loc, 32, 0, 0, 0, .1); loc.getWorld().playSound(loc, Sound.ENTITY_BLAZE_HURT, 2, 1); target.setFireTicks((int) (target.getFireTicks() + data.getModifier("ignite") * 20)); - MMOItems.plugin.getDamage().damage(stats, target, data.getModifier("damage"), DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, target, data.getModifier("damage"), DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGICAL); cancel(); } } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Throw_Up.java b/src/main/java/net/Indyuce/mmoitems/ability/Throw_Up.java index 66a25083..6448b1b9 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Throw_Up.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Throw_Up.java @@ -15,9 +15,9 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; import net.Indyuce.mmoitems.api.util.NoInteractItemEntity; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.nms.ItemTag; @@ -54,7 +54,7 @@ public class Throw_Up extends Ability implements Listener { if (ent.getLocation().distanceSquared(loc) < 40) if (stats.getPlayer().getEyeLocation().getDirection().angle(ent.getLocation().toVector().subtract(stats.getPlayer().getLocation().toVector())) < Math.PI / 6) if (MMOUtils.canDamage(stats.getPlayer(), ent)) - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) ent, dps, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) ent, dps, DamageType.SKILL, DamageType.MAGICAL); loc.getWorld().playSound(loc, Sound.ENTITY_ZOMBIE_HURT, 1, 1); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Thrust.java b/src/main/java/net/Indyuce/mmoitems/ability/Thrust.java index 9bca94c8..e9c394ed 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Thrust.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Thrust.java @@ -13,8 +13,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Thrust extends Ability { @@ -40,7 +40,7 @@ public class Thrust extends Ability { loc.add(vec); for (Entity entity : MMOUtils.getNearbyChunkEntities(loc)) if (MMOUtils.canDamage(stats.getPlayer(), loc, entity)) - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.PHYSICAL); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.PHYSICAL); loc.getWorld().spawnParticle(Particle.SMOKE_LARGE, loc, 0); } } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/arcane/Arcane_Hail.java b/src/main/java/net/Indyuce/mmoitems/ability/arcane/Arcane_Hail.java index d615fa55..cb2744cf 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/arcane/Arcane_Hail.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/arcane/Arcane_Hail.java @@ -11,8 +11,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -54,7 +54,7 @@ public class Arcane_Hail extends Ability { loc1.getWorld().playSound(loc1, VersionSound.ENTITY_ENDERMAN_HURT.toSound(), 1, 0); for (Entity entity : MMOUtils.getNearbyChunkEntities(loc1)) if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc1) <= 4) - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.MAGICAL); loc1.getWorld().spawnParticle(Particle.SPELL_WITCH, loc1, 12, 0, 0, 0, .1); loc1.getWorld().spawnParticle(Particle.SMOKE_NORMAL, loc1, 6, 0, 0, 0, .1); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/arcane/Arcane_Rift.java b/src/main/java/net/Indyuce/mmoitems/ability/arcane/Arcane_Rift.java index 63fa8e08..ff873d9f 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/arcane/Arcane_Rift.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/arcane/Arcane_Rift.java @@ -16,8 +16,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.version.VersionSound; @@ -62,7 +62,7 @@ public class Arcane_Rift extends Ability { for (Entity entity : MMOUtils.getNearbyChunkEntities(loc)) if (MMOUtils.canDamage(stats.getPlayer(), entity) && loc.distanceSquared(entity.getLocation()) < 2 && !hit.contains(entity.getEntityId())) { hit.add(entity.getEntityId()); - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage1, DamageType.SKILL, DamageType.MAGICAL); ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier)); } } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Death_Mark.java b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Death_Mark.java index 5f21e606..c94de292 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Death_Mark.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Death_Mark.java @@ -10,8 +10,8 @@ import org.bukkit.scheduler.BukkitRunnable; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Death_Mark extends Ability { @@ -50,7 +50,7 @@ public class Death_Mark extends Ability { target.getWorld().spawnParticle(Particle.SPELL_MOB, target.getLocation(), 4, .2, 0, .2, 0); if (ti % 20 == 0) - MMOItems.plugin.getDamage().damage(stats, target, dps, DamageType.MAGIC, false); + MMOItems.plugin.getDamage().damage(stats, target, dps, false, DamageType.SKILL, DamageType.MAGICAL); } }.runTaskTimer(MMOItems.plugin, 0, 1); target.getWorld().playSound(target.getLocation(), Sound.ENTITY_BLAZE_HURT, 1, 2); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Minor_Explosion.java b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Minor_Explosion.java index 949cbbea..017890da 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Minor_Explosion.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Minor_Explosion.java @@ -11,8 +11,8 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.Ability; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.data.AbilityData; public class Minor_Explosion extends Ability { @@ -45,7 +45,7 @@ public class Minor_Explosion extends Ability { for (Entity entity : MMOUtils.getNearbyChunkEntities(loc)) if (entity.getLocation().distanceSquared(loc) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity)) { - MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage, DamageType.MAGIC); + MMOItems.plugin.getDamage().damage(stats, (LivingEntity) entity, damage, DamageType.SKILL, DamageType.MAGICAL); entity.setVelocity(normalizeIfNotNull(entity.getLocation().subtract(loc).toVector().setY(0)).setY(.2).multiply(2 * knockback)); } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/AttackResult.java b/src/main/java/net/Indyuce/mmoitems/api/AttackResult.java index c7ea0573..268cf07a 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/AttackResult.java +++ b/src/main/java/net/Indyuce/mmoitems/api/AttackResult.java @@ -9,11 +9,11 @@ import org.bukkit.entity.Player; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.Ability.CastingMode; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.Weapon; import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.type.ItemStat; public class AttackResult { @@ -87,8 +87,8 @@ public class AttackResult { // applyEffectsAndDamage(stats, item, target, DamageType.WEAPON); // } - public void applyEffectsAndDamage(TemporaryStats stats, NBTItem item, LivingEntity target, DamageType type) { - MMOItems.plugin.getDamage().damage(stats, target, applyEffects(stats, item, target).damage, type); + public void applyEffectsAndDamage(TemporaryStats stats, NBTItem item, LivingEntity target, DamageType... types) { + MMOItems.plugin.getDamage().damage(stats, target, applyEffects(stats, item, target).damage, types); } public AttackResult applyElementalEffects(TemporaryStats stats, NBTItem item, LivingEntity target) { diff --git a/src/main/java/net/Indyuce/mmoitems/api/DamageInfo.java b/src/main/java/net/Indyuce/mmoitems/api/DamageInfo.java new file mode 100644 index 00000000..2ad99a0b --- /dev/null +++ b/src/main/java/net/Indyuce/mmoitems/api/DamageInfo.java @@ -0,0 +1,68 @@ +package net.Indyuce.mmoitems.api; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import org.apache.commons.lang.Validate; + +public class DamageInfo { + private final Set types; + private final double value; + + public DamageInfo(DamageType... type) { + this(0, type); + } + + public DamageInfo(double value, DamageType... types) { + Validate.notEmpty(types, "Damage must have at least one damage type!"); + + this.types = new HashSet<>(Arrays.asList(types)); + this.value = value; + } + + public DamageInfo merge(DamageInfo info) { + types.addAll(info.getTypes()); + return this; + } + + public Set getTypes() { + return types; + } + + public boolean hasType(DamageType type) { + return types.contains(type); + } + + public double getValue() { + return value; + } + + public enum DamageType { + + /* + * skills or abilities dealing magic damage + */ + MAGICAL, + + /* + * skills or abilities dealing physical damage + */ + PHYSICAL, + + /* + * weapons dealing damage + */ + WEAPON, + + /* + * skill damage + */ + SKILL, + + /* + * projectile based weapons or skills + */ + PROJECTILE; + } +} diff --git a/src/main/java/net/Indyuce/mmoitems/api/Element.java b/src/main/java/net/Indyuce/mmoitems/api/Element.java index c19578ff..903eec29 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/Element.java +++ b/src/main/java/net/Indyuce/mmoitems/api/Element.java @@ -18,9 +18,9 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; import net.Indyuce.mmoitems.listener.ElementListener; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.version.VersionMaterial; import net.Indyuce.mmoitems.version.VersionSound; diff --git a/src/main/java/net/Indyuce/mmoitems/api/TypeSet.java b/src/main/java/net/Indyuce/mmoitems/api/TypeSet.java index edc22f90..ea9ea558 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/TypeSet.java +++ b/src/main/java/net/Indyuce/mmoitems/api/TypeSet.java @@ -12,10 +12,10 @@ import org.bukkit.potion.PotionEffectType; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.Weapon; import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.type.ItemStat; import net.Indyuce.mmoitems.version.VersionSound; diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Lute.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Lute.java index d6c26bbc..454552d3 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Lute.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Lute.java @@ -14,12 +14,12 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.Type; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; import net.Indyuce.mmoitems.api.util.SoundReader; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.Lute_Attack_Effect.LuteAttackEffect; import net.Indyuce.mmoitems.stat.type.ItemStat; import net.Indyuce.mmoitems.version.VersionSound; @@ -69,7 +69,7 @@ public class Lute extends UntargetedWeapon { for (Entity target : entities) if (MMOUtils.canDamage(getPlayer(), loc, target)) { - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, getNBTItem(), (LivingEntity) target, DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, getNBTItem(), (LivingEntity) target, DamageType.WEAPON, DamageType.PROJECTILE); cancel(); return; } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Musket.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Musket.java index 7f6e1e22..e12b78e9 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Musket.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Musket.java @@ -8,12 +8,12 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.Type; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; import net.Indyuce.mmoitems.api.util.MMORayTraceResult; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.type.ItemStat; public class Musket extends UntargetedWeapon { @@ -46,7 +46,7 @@ public class Musket extends UntargetedWeapon { MMORayTraceResult trace = MMOItems.plugin.getVersion().getVersionWrapper().rayTrace(stats.getPlayer(), vec, range); if (trace.hasHit()) - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, getNBTItem(), trace.getHit(), DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, getNBTItem(), trace.getHit(), DamageType.WEAPON, DamageType.PROJECTILE); trace.draw(loc, vec, 2, Color.BLACK); getPlayer().getWorld().playSound(getPlayer().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 2, 2); } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Staff.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Staff.java index 0a5d5de2..0c78bd6f 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Staff.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Staff.java @@ -10,12 +10,12 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.Type; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; import net.Indyuce.mmoitems.api.util.MMORayTraceResult; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.Staff_Spirit.StaffSpirit; import net.Indyuce.mmoitems.stat.type.ItemStat; import net.Indyuce.mmoitems.version.VersionSound; @@ -46,7 +46,7 @@ public class Staff extends UntargetedWeapon { MMORayTraceResult trace = MMOItems.plugin.getVersion().getVersionWrapper().rayTrace(stats.getPlayer(), range); if (trace.hasHit()) - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, getNBTItem(), trace.getHit(), DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, getNBTItem(), trace.getHit(), DamageType.WEAPON, DamageType.PROJECTILE); trace.draw(loc, getPlayer().getEyeLocation().getDirection(), 2, (tick) -> tick.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, tick, 0, .1, .1, .1, 0)); getPlayer().getWorld().playSound(getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 2); } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Whip.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Whip.java index 55b229a2..781a1618 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Whip.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Whip.java @@ -7,12 +7,12 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.Type; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; import net.Indyuce.mmoitems.api.util.MMORayTraceResult; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.type.ItemStat; import net.Indyuce.mmoitems.version.VersionSound; @@ -36,7 +36,7 @@ public class Whip extends UntargetedWeapon { MMORayTraceResult trace = MMOItems.plugin.getVersion().getVersionWrapper().rayTrace(stats.getPlayer(), range); if (trace.hasHit()) - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, getNBTItem(), trace.getHit(), DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, getNBTItem(), trace.getHit(), DamageType.WEAPON, DamageType.PROJECTILE); 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); } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/BruteLuteAttack.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/BruteLuteAttack.java index 40bcc1ae..9493e1fc 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/BruteLuteAttack.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/BruteLuteAttack.java @@ -13,10 +13,10 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; public class BruteLuteAttack implements LuteAttackHandler { @@ -44,7 +44,7 @@ public class BruteLuteAttack implements LuteAttackHandler { for (Entity target : entities) if (MMOUtils.canDamage(stats.getPlayer(), loc, target)) { - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.WEAPON, DamageType.PROJECTILE); cancel(); return; } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/CircularLuteAttack.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/CircularLuteAttack.java index 4ac9657e..d8528b16 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/CircularLuteAttack.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/CircularLuteAttack.java @@ -13,10 +13,10 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; public class CircularLuteAttack implements LuteAttackHandler { @@ -47,7 +47,7 @@ public class CircularLuteAttack implements LuteAttackHandler { for (Entity target : entities) if (MMOUtils.canDamage(stats.getPlayer(), loc, target)) { - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.WEAPON, DamageType.PROJECTILE); cancel(); return; } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SimpleLuteAttack.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SimpleLuteAttack.java index 1aca1432..68c7e79b 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SimpleLuteAttack.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SimpleLuteAttack.java @@ -13,10 +13,10 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; public class SimpleLuteAttack implements LuteAttackHandler { @@ -44,7 +44,7 @@ public class SimpleLuteAttack implements LuteAttackHandler { for (Entity target : entities) if (MMOUtils.canDamage(stats.getPlayer(), loc, target)) { - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.WEAPON, DamageType.PROJECTILE); cancel(); return; } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SlashLuteAttack.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SlashLuteAttack.java index db29bd90..a61e71e1 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SlashLuteAttack.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SlashLuteAttack.java @@ -11,10 +11,10 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; public class SlashLuteAttack implements LuteAttackHandler { @@ -42,6 +42,6 @@ public class SlashLuteAttack implements LuteAttackHandler { for (Entity entity : MMOUtils.getNearbyChunkEntities(stats.getPlayer().getLocation())) if (entity.getLocation().distanceSquared(stats.getPlayer().getLocation()) < 40 && stats.getPlayer().getEyeLocation().getDirection().angle(entity.getLocation().toVector().subtract(stats.getPlayer().getLocation().toVector())) < Math.PI / 6 && MMOUtils.canDamage(stats.getPlayer(), entity)) - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) entity, DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) entity, DamageType.WEAPON, DamageType.PROJECTILE); } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/WaveLuteAttack.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/WaveLuteAttack.java index 04ca1350..918417cb 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/WaveLuteAttack.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/WaveLuteAttack.java @@ -13,10 +13,10 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; public class WaveLuteAttack implements LuteAttackHandler { @@ -46,7 +46,7 @@ public class WaveLuteAttack implements LuteAttackHandler { for (Entity target : entities) if (MMOUtils.canDamage(stats.getPlayer(), loc, target)) { - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.WEAPON, DamageType.PROJECTILE); cancel(); return; } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/LightningSpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/LightningSpirit.java index ae812b79..5da4cda4 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/LightningSpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/LightningSpirit.java @@ -8,10 +8,10 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.version.VersionSound; public class LightningSpirit implements StaffAttackHandler { @@ -29,7 +29,7 @@ public class LightningSpirit implements StaffAttackHandler { loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 0); for (Entity target : MMOUtils.getNearbyChunkEntities(loc)) if (MMOUtils.canDamage(stats.getPlayer(), loc, target)) { - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.WEAPON, DamageType.PROJECTILE); loc.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, loc, 16, 0, 0, 0, .1); return; } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ManaSpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ManaSpirit.java index 1c6aeace..a7c95074 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ManaSpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ManaSpirit.java @@ -14,10 +14,10 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; public class ManaSpirit implements StaffAttackHandler { @@ -51,7 +51,7 @@ public class ManaSpirit implements StaffAttackHandler { } for (Entity target : targets) if (MMOUtils.canDamage(stats.getPlayer(), loc, target)) { - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.WEAPON, DamageType.PROJECTILE); loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0); cancel(); return; diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/NetherSpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/NetherSpirit.java index 4494f7aa..65ff827e 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/NetherSpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/NetherSpirit.java @@ -13,10 +13,10 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; public class NetherSpirit implements StaffAttackHandler { @@ -43,7 +43,7 @@ public class NetherSpirit implements StaffAttackHandler { loc.getWorld().spawnParticle(Particle.SMOKE_NORMAL, loc, 0); for (Entity target : targets) if (MMOUtils.canDamage(stats.getPlayer(), loc, target)) { - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.WEAPON, DamageType.PROJECTILE); loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0); cancel(); return; diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/SunfireSpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/SunfireSpirit.java index 78d08c7f..45445102 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/SunfireSpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/SunfireSpirit.java @@ -14,10 +14,10 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.version.VersionSound; public class SunfireSpirit implements StaffAttackHandler { @@ -45,7 +45,7 @@ public class SunfireSpirit implements StaffAttackHandler { loc.getWorld().playSound(loc, VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 2, 2); for (Entity target : MMOUtils.getNearbyChunkEntities(loc)) if (MMOUtils.canDamage(stats.getPlayer(), target) && target.getLocation().distanceSquared(loc) <= 9) - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.WEAPON, DamageType.PROJECTILE); cancel(); break; } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ThunderSpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ThunderSpirit.java index 80b86cdf..7e6416f7 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ThunderSpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ThunderSpirit.java @@ -14,10 +14,10 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.version.VersionSound; public class ThunderSpirit implements StaffAttackHandler { @@ -43,7 +43,7 @@ public class ThunderSpirit implements StaffAttackHandler { loc.getWorld().playSound(loc, VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 2, 2); for (Entity target : MMOUtils.getNearbyChunkEntities(loc)) if (MMOUtils.canDamage(stats.getPlayer(), target) && target.getLocation().distanceSquared(loc) <= 9) - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, (LivingEntity) target, DamageType.WEAPON, DamageType.PROJECTILE); cancel(); } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/XRaySpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/XRaySpirit.java index f9931191..06399c65 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/XRaySpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/XRaySpirit.java @@ -7,11 +7,11 @@ import org.bukkit.util.Vector; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.AttackResult; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon; import net.Indyuce.mmoitems.api.item.NBTItem; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; import net.Indyuce.mmoitems.api.util.MMORayTraceResult; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; public class XRaySpirit implements StaffAttackHandler { @@ -24,7 +24,7 @@ public class XRaySpirit implements StaffAttackHandler { MMORayTraceResult trace = MMOItems.plugin.getVersion().getVersionWrapper().rayTrace(stats.getPlayer(), range); if (trace.hasHit()) - new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, trace.getHit(), DamageType.PROJECTILE); + new AttackResult(untargeted, attackDamage).applyEffectsAndDamage(stats, nbt, trace.getHit(), DamageType.WEAPON, DamageType.PROJECTILE); trace.draw(loc, stats.getPlayer().getEyeLocation().getDirection(), 2, Color.BLACK); stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 2, 2); } diff --git a/src/main/java/net/Indyuce/mmoitems/comp/mmocore/MMOCoreDamageHandler.java b/src/main/java/net/Indyuce/mmoitems/comp/mmocore/MMOCoreDamageHandler.java index 819527a5..52334a6f 100644 --- a/src/main/java/net/Indyuce/mmoitems/comp/mmocore/MMOCoreDamageHandler.java +++ b/src/main/java/net/Indyuce/mmoitems/comp/mmocore/MMOCoreDamageHandler.java @@ -1,5 +1,7 @@ package net.Indyuce.mmoitems.comp.mmocore; +import java.util.stream.Collectors; + import org.bukkit.entity.Entity; import net.Indyuce.mmocore.comp.rpg.damage.DamageHandler; @@ -11,8 +13,8 @@ public class MMOCoreDamageHandler implements DamageHandler { @Override public DamageInfo getDamage(Entity entity) { - net.Indyuce.mmoitems.manager.DamageManager.DamageInfo miInfo = MMOItems.plugin.getDamage().getDamage(entity); - return new DamageInfo(DamageType.valueOf(miInfo.getType().name()), miInfo.getValue()); + net.Indyuce.mmoitems.api.DamageInfo mmoitemsInfo = MMOItems.plugin.getDamage().getDamage(entity); + return new DamageInfo(mmoitemsInfo.getValue(), mmoitemsInfo.getTypes().stream().map((type) -> DamageType.valueOf(type.name())).collect(Collectors.toSet())); } @Override diff --git a/src/main/java/net/Indyuce/mmoitems/comp/mmocore/MMOCoreHook.java b/src/main/java/net/Indyuce/mmoitems/comp/mmocore/MMOCoreHook.java index 59694c11..305f0b75 100644 --- a/src/main/java/net/Indyuce/mmoitems/comp/mmocore/MMOCoreHook.java +++ b/src/main/java/net/Indyuce/mmoitems/comp/mmocore/MMOCoreHook.java @@ -1,17 +1,22 @@ package net.Indyuce.mmoitems.comp.mmocore; import org.bukkit.Bukkit; +import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.inventory.ItemStack; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.stats.StatType; +import net.Indyuce.mmocore.comp.rpg.damage.DamageInfo.DamageType; import net.Indyuce.mmoitems.MMOItems; +import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.player.RPGPlayer; import net.Indyuce.mmoitems.comp.rpg.RPGHandler; +import net.Indyuce.mmoitems.stat.type.DoubleStat; import net.Indyuce.mmoitems.stat.type.ItemStat; public class MMOCoreHook implements RPGHandler, Listener { @@ -27,6 +32,11 @@ public class MMOCoreHook implements RPGHandler, Listener { * register custom damage */ MMOCore.plugin.damage.registerHandler(new MMOCoreDamageHandler()); + + MMOItems.plugin.getStats().register(StatType.COOLDOWN_REDUCTION.name(), new DoubleStat(new ItemStack(Material.BOOK), "Skill Cooldown Reduction", new String[] { "(%) Reduces cooldowns of MMOCore skills." }, "skill-cooldown-reduction")); + MMOItems.plugin.getStats().register(StatType.ADDITIONAL_EXPERIENCE.name(), new DoubleStat(new ItemStack(Material.EXPERIENCE_BOTTLE), "Additional Experience", new String[] { "Additional % MMOCore main class experience." }, "additional-experience")); + for (DamageType type : DamageType.values()) + MMOItems.plugin.getStats().register(type.name() + "_DAMAGE", new DoubleStat(new ItemStack(Material.GRAY_DYE), MMOUtils.caseOnWords(type.name().toLowerCase().replace("_", " ")) + " Damage (MMOCore)", new String[] { "Additional % MMOCore main class experience." }, "additional-experience")); } @Override diff --git a/src/main/java/net/Indyuce/mmoitems/comp/rpg/SkillAPIHook.java b/src/main/java/net/Indyuce/mmoitems/comp/rpg/SkillAPIHook.java index e618f237..3854af0c 100644 --- a/src/main/java/net/Indyuce/mmoitems/comp/rpg/SkillAPIHook.java +++ b/src/main/java/net/Indyuce/mmoitems/comp/rpg/SkillAPIHook.java @@ -13,7 +13,6 @@ import com.sucy.skill.api.player.PlayerData; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.player.RPGPlayer; -import net.Indyuce.mmoitems.manager.DamageManager.DamageType; import net.Indyuce.mmoitems.stat.type.ItemStat; public class SkillAPIHook implements RPGHandler, Listener { @@ -29,12 +28,6 @@ public class SkillAPIHook implements RPGHandler, Listener { @EventHandler public void a(SkillDamageEvent event) { - /* - * registers the target as a custom damaged entity, this way MMOItems - * weapons effects do not apply when the entity is hit - */ - MMOItems.plugin.getDamage().setDamaged(event.getTarget(), event.getDamage(), DamageType.MAGIC); - if (event.getDamager() instanceof Player) event.setDamage(event.getDamage() * (1 + net.Indyuce.mmoitems.api.player.PlayerData.get((Player) event.getDamager()).getStats().getStat(ItemStat.MAGIC_DAMAGE) / 100)); diff --git a/src/main/java/net/Indyuce/mmoitems/manager/DamageManager.java b/src/main/java/net/Indyuce/mmoitems/manager/DamageManager.java index ade06025..18e2f1c3 100644 --- a/src/main/java/net/Indyuce/mmoitems/manager/DamageManager.java +++ b/src/main/java/net/Indyuce/mmoitems/manager/DamageManager.java @@ -15,6 +15,8 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; +import net.Indyuce.mmoitems.api.DamageInfo; +import net.Indyuce.mmoitems.api.DamageInfo.DamageType; import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats; import net.Indyuce.mmoitems.stat.type.ItemStat; @@ -25,24 +27,15 @@ public class DamageManager implements Listener { return customDamage.containsKey(entity.getEntityId()); } - public void setDamaged(Entity entity, double value, DamageType type) { - if (!customDamage.containsKey(entity.getEntityId())) - customDamage.put(entity.getEntityId(), new DamageInfo(value, type)); - } - public DamageInfo getDamage(Entity entity) { return customDamage.get(entity.getEntityId()); } - public void removeDamaged(Entity entity) { - customDamage.remove(Integer.valueOf(entity.getEntityId())); + public void damage(TemporaryStats playerStats, LivingEntity target, double value, DamageType... types) { + damage(playerStats, target, value, true, types); } - public void damage(TemporaryStats playerStats, LivingEntity target, double value, DamageType damageType) { - damage(playerStats, target, value, damageType, true); - } - - public void damage(TemporaryStats playerStats, LivingEntity target, double value, DamageType damageType, boolean knockback) { + public void damage(TemporaryStats playerStats, LivingEntity target, double value, boolean knockback, DamageType... types) { if (target.hasMetadata("NPC") || playerStats.getPlayer().hasMetadata("NPC")) return; @@ -50,13 +43,16 @@ public class DamageManager implements Listener { * calculate extra damage depending on the type of attack and the entity * that is being damaged */ - if (damageType.isSpell()) { - value *= 1 + (damageType == DamageType.MAGIC ? playerStats.getStat(ItemStat.MAGIC_DAMAGE) / 100 : 0); - value *= 1 + (isUndead(target) ? playerStats.getStat(ItemStat.UNDEAD_DAMAGE) / 100 : 0); + DamageInfo info = new DamageInfo(value, types); + if (info.hasType(DamageType.SKILL)) { + if (info.hasType(DamageType.MAGICAL)) + value *= 1 + playerStats.getStat(ItemStat.MAGIC_DAMAGE) / 100; + if (isUndead(target)) + value *= 1 + playerStats.getStat(ItemStat.UNDEAD_DAMAGE) / 100; value *= 1 + (playerStats.getStat(target instanceof Player ? ItemStat.PVP_DAMAGE : ItemStat.PVE_DAMAGE) / 100); } - setDamaged(target, value, damageType); + customDamage.put(target.getEntityId(), info); if (!knockback) { final double baseKnockbackValue = target.getAttribute(Attribute.GENERIC_KNOCKBACK_RESISTANCE).getBaseValue(); @@ -77,45 +73,8 @@ public class DamageManager implements Listener { return entity instanceof Zombie || entity instanceof Skeleton || entity instanceof Wither; } - public enum DamageType { - - // damage dealt by weapons & weapon passives - WEAPON, - - // damage dealt by physical skills - PHYSICAL, - - // damage dealt by magical abilities - MAGIC, - - // damage dealt by projectile based weapons - PROJECTILE; - - public boolean isSpell() { - return this == MAGIC || this == PHYSICAL; - } - } - - public class DamageInfo { - private final double value; - private final DamageType type; - - private DamageInfo(double value, DamageType type) { - this.value = value; - this.type = type; - } - - public double getValue() { - return value; - } - - public DamageType getType() { - return type; - } - } - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = false) public void a(EntityDamageByEntityEvent event) { - removeDamaged(event.getEntity()); + customDamage.remove(Integer.valueOf(event.getEntity().getEntityId())); } }