diff --git a/lib/MMOLib.jar b/lib/MMOLib.jar index dca2eead..5311a1d1 100644 Binary files a/lib/MMOLib.jar and b/lib/MMOLib.jar differ diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Contamination.java b/src/main/java/net/Indyuce/mmoitems/ability/Contamination.java index 920fd1b2..b328a874 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Contamination.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Contamination.java @@ -22,7 +22,8 @@ import net.mmogroup.mmolib.version.VersionSound; public class Contamination extends Ability { public Contamination() { - super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK); + super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, + CastingMode.SHIFT_RIGHT_CLICK); addModifier("damage", 2); addModifier("duration", 8); @@ -35,7 +36,7 @@ public class Contamination extends Ability { public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) { return new LocationAbilityResult(ability, stats.getPlayer(), target); } - + @Override public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) { Location loc = ((LocationAbilityResult) ability).getTarget(); @@ -53,7 +54,8 @@ public class Contamination extends Ability { if (j >= duration) cancel(); - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(ti / 3) * 5, 0, Math.sin(ti / 3) * 5), Color.PURPLE); + loc.getWorld().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(ti / 3) * 5, 0, Math.sin(ti / 3) * 5), 1, + new Particle.DustOptions(Color.PURPLE, 1)); for (int j = 0; j < 3; j++) { ti += Math.PI / 32; double r = Math.sin(ti / 2) * 4; @@ -65,7 +67,8 @@ 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) - MMOLib.plugin.getDamage().damage(stats.getPlayer(), (LivingEntity) entity, new AttackResult(dps, DamageType.SKILL, DamageType.MAGIC), false); + MMOLib.plugin.getDamage().damage(stats.getPlayer(), (LivingEntity) entity, + new AttackResult(dps, DamageType.SKILL, DamageType.MAGIC), false); } } }.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 2e102e36..72187d71 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Corrupt.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Corrupt.java @@ -15,14 +15,14 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult; import net.Indyuce.mmoitems.api.ability.LocationAbilityResult; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.stat.data.AbilityData; -import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.api.AttackResult; import net.mmogroup.mmolib.api.DamageType; import net.mmogroup.mmolib.version.VersionSound; public class Corrupt extends Ability { public Corrupt() { - super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK); + super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, + CastingMode.SHIFT_RIGHT_CLICK); addModifier("damage", 8); addModifier("duration", 4); @@ -52,7 +52,7 @@ public class Corrupt extends Ability { Location loc1 = loc.clone().add(Math.cos(j) * radius, 1, Math.sin(j) * radius); double y_max = .5 + random.nextDouble(); for (double y = 0; y < y_max; y += .1) - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc1.clone().add(0, y, 0), Color.PURPLE); + loc1.getWorld().spawnParticle(Particle.REDSTONE, loc1.clone().add(0, y, 0), 1, new Particle.DustOptions(Color.PURPLE, 1)); } for (Entity entity : MMOUtils.getNearbyChunkEntities(loc)) 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 2bc3179a..040c4574 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Ice_Crystal.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Ice_Crystal.java @@ -21,14 +21,14 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult; import net.Indyuce.mmoitems.api.ability.VectorAbilityResult; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.stat.data.AbilityData; -import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.api.AttackResult; import net.mmogroup.mmolib.api.DamageType; import net.mmogroup.mmolib.version.VersionSound; public class Ice_Crystal extends Ability { public Ice_Crystal() { - super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK); + super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, + CastingMode.SHIFT_RIGHT_CLICK); addModifier("damage", 6); addModifier("duration", 3); @@ -70,9 +70,10 @@ public class Ice_Crystal extends Ability { */ for (double r = 0; r < .4; r += .1) for (double a = 0; a < Math.PI * 2; a += Math.PI / 2) { - Vector vec = MMOUtils.rotateFunc(new Vector(r * Math.cos(a + (double) ti / 10), r * Math.sin(a + (double) ti / 10), 0), loc); + Vector vec = MMOUtils.rotateFunc(new Vector(r * Math.cos(a + (double) ti / 10), r * Math.sin(a + (double) ti / 10), 0), + loc); loc.add(vec); - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc, .7f, Color.WHITE); + loc.getWorld().spawnParticle(Particle.REDSTONE, loc, 1, new Particle.DustOptions(Color.WHITE, .7f)); loc.add(vec.multiply(-1)); } @@ -81,8 +82,10 @@ 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); - new AttackResult(ability.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE).damage(stats.getPlayer(), (LivingEntity) entity); - ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (ability.getModifier("duration") * 20), (int) ability.getModifier("amplifier"))); + new AttackResult(ability.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE) + .damage(stats.getPlayer(), (LivingEntity) entity); + ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, + (int) (ability.getModifier("duration") * 20), (int) ability.getModifier("amplifier"))); cancel(); return; } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Magical_Shield.java b/src/main/java/net/Indyuce/mmoitems/ability/Magical_Shield.java index d3e2d287..2f1c3bc1 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Magical_Shield.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Magical_Shield.java @@ -19,12 +19,12 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult; import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.stat.data.AbilityData; -import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.version.VersionSound; public class Magical_Shield extends Ability { public Magical_Shield() { - super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK); + super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, + CastingMode.SHIFT_RIGHT_CLICK); addModifier("power", 40); addModifier("radius", 5); @@ -85,7 +85,9 @@ public class Magical_Shield extends Ability { for (double j = 0; j < Math.PI / 2; j += Math.PI / (28 + random.nextInt(5))) for (double i = 0; i < Math.PI * 2; i += Math.PI / (14 + random.nextInt(5))) - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(2.5 * Math.cos(i + j) * Math.sin(j), 2.5 * Math.cos(j), 2.5 * Math.sin(i + j) * Math.sin(j)), Color.FUCHSIA); + loc.getWorld().spawnParticle(Particle.REDSTONE, + loc.clone().add(2.5 * Math.cos(i + j) * Math.sin(j), 2.5 * Math.cos(j), 2.5 * Math.sin(i + j) * Math.sin(j)), 1, + new Particle.DustOptions(Color.FUCHSIA, 1)); } } } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Shockwave.java b/src/main/java/net/Indyuce/mmoitems/ability/Shockwave.java index be007dfa..1395869b 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Shockwave.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Shockwave.java @@ -21,11 +21,11 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult; import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.stat.data.AbilityData; -import net.mmogroup.mmolib.MMOLib; public class Shockwave extends Ability { public Shockwave() { - super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK); + super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, + CastingMode.SHIFT_RIGHT_CLICK); addModifier("cooldown", 7.5); addModifier("knock-up", 1); @@ -58,10 +58,11 @@ public class Shockwave extends Ability { loc.add(vec); loc.getWorld().playSound(loc, Sound.BLOCK_GRAVEL_BREAK, 1, 2); - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.BLOCK_CRACK, loc, 12, .5, 0, .5, 0, Material.DIRT); + loc.getWorld().spawnParticle(Particle.BLOCK_CRACK, loc, 12, .5, 0, .5, 0, Material.DIRT.createBlockData()); for (Entity ent : MMOUtils.getNearbyChunkEntities(loc)) - if (ent.getLocation().distance(loc) < 1.1 && ent instanceof LivingEntity && !ent.equals(stats.getPlayer()) && !hit.contains(ent.getEntityId())) { + if (ent.getLocation().distance(loc) < 1.1 && ent instanceof LivingEntity && !ent.equals(stats.getPlayer()) + && !hit.contains(ent.getEntityId())) { hit.add(ent.getEntityId()); ent.playEffect(EntityEffect.HURT); ent.setVelocity(ent.getVelocity().setY(.4 * knockUp)); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/Shulker_Missile.java b/src/main/java/net/Indyuce/mmoitems/ability/Shulker_Missile.java index ecfecf4b..4a8ec2be 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/Shulker_Missile.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/Shulker_Missile.java @@ -23,7 +23,6 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult; import net.Indyuce.mmoitems.api.ability.VectorAbilityResult; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.stat.data.AbilityData; -import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.api.AttackResult; import net.mmogroup.mmolib.api.DamageType; import net.mmogroup.mmolib.api.item.NBTItem; @@ -121,8 +120,8 @@ public class Shulker_Missile extends Ability implements Listener { y += .04; for (int j = 0; j < 2; j++) { double xz = y * Math.PI * 1.3 + (j * Math.PI); - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(xz), y, Math.sin(xz)), - Color.MAROON); + loc.getWorld().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(xz), y, Math.sin(xz)), 1, + new Particle.DustOptions(Color.MAROON, 1)); } } if (y >= 2) diff --git a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Blind.java b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Blind.java index 73103933..7e60410b 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Blind.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Blind.java @@ -15,12 +15,12 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult; import net.Indyuce.mmoitems.api.ability.TargetAbilityResult; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.stat.data.AbilityData; -import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.version.VersionSound; public class Blind extends Ability { public Blind() { - super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK); + super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, + CastingMode.SHIFT_RIGHT_CLICK); addModifier("duration", 5); addModifier("cooldown", 9); @@ -28,7 +28,6 @@ public class Blind extends Ability { addModifier("stamina", 0); } - @Override public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) { return new TargetAbilityResult(ability, stats.getPlayer(), target); @@ -37,13 +36,14 @@ public class Blind extends Ability { @Override public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) { LivingEntity target = ((TargetAbilityResult) ability).getTarget(); - + target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_ENDERMAN_HURT.toSound(), 1, 2); for (double i = 0; i < Math.PI * 2; i += Math.PI / 24) for (double j = 0; j < 2; j++) { Location loc = target.getLocation(); - Vector vec = MMOUtils.rotateFunc(new Vector(Math.cos(i), 1 + Math.cos(i + (Math.PI * j)) * .5, Math.sin(i)), stats.getPlayer().getLocation()); - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.add(vec), Color.BLACK); + Vector vec = MMOUtils.rotateFunc(new Vector(Math.cos(i), 1 + Math.cos(i + (Math.PI * j)) * .5, Math.sin(i)), + stats.getPlayer().getLocation()); + loc.getWorld().spawnParticle(Particle.REDSTONE, loc.add(vec), 1, new Particle.DustOptions(Color.BLACK, 1)); } target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, (int) (ability.getModifier("duration") * 20), 0)); } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Slow.java b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Slow.java index 65d02ddf..cf003f56 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Slow.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Slow.java @@ -16,11 +16,11 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult; import net.Indyuce.mmoitems.api.ability.TargetAbilityResult; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.stat.data.AbilityData; -import net.mmogroup.mmolib.MMOLib; public class Slow extends Ability { public Slow() { - super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK); + super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, + CastingMode.SHIFT_RIGHT_CLICK); addModifier("cooldown", 5); addModifier("duration", 3); @@ -49,11 +49,14 @@ public class Slow extends Ability { for (double j = 0; j < Math.PI * 2; j += Math.PI) for (double r = 0; r < .7; r += .1) - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos((ti / 2) + j + (Math.PI * r)) * r * 2, .1, Math.sin((ti / 2) + j + (Math.PI * r)) * r * 2), Color.WHITE); + loc.getWorld().spawnParticle(Particle.REDSTONE, + loc.clone().add(Math.cos((ti / 2) + j + (Math.PI * r)) * r * 2, .1, Math.sin((ti / 2) + j + (Math.PI * r)) * r * 2), + 1, new Particle.DustOptions(Color.WHITE, 1)); } }.runTaskTimer(MMOItems.plugin, 0, 1); target.getWorld().playSound(target.getLocation(), Sound.ENTITY_LLAMA_ANGRY, 1, 2); - target.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (ability.getModifier("duration") * 20), (int) ability.getModifier("amplifier"))); + target.addPotionEffect( + new PotionEffect(PotionEffectType.SLOW, (int) (ability.getModifier("duration") * 20), (int) ability.getModifier("amplifier"))); } } diff --git a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Vampirism.java b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Vampirism.java index bc811617..adfa226b 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Vampirism.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Vampirism.java @@ -15,11 +15,11 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult; import net.Indyuce.mmoitems.api.ability.TargetAbilityResult; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.stat.data.AbilityData; -import net.mmogroup.mmolib.MMOLib; public class Vampirism extends Ability { public Vampirism() { - super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK); + super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, + CastingMode.SHIFT_RIGHT_CLICK); addModifier("cooldown", 8); addModifier("drain", 10); @@ -47,7 +47,9 @@ public class Vampirism extends Ability { dis += ti <= 10 ? .15 : -.15; for (double j = 0; j < Math.PI * 2; j += Math.PI / 4) - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(j + (ti / 20)) * dis, 0, Math.sin(j + (ti / 20)) * dis), Color.RED); + loc.getWorld().spawnParticle(Particle.REDSTONE, + loc.clone().add(Math.cos(j + (ti / 20)) * dis, 0, Math.sin(j + (ti / 20)) * dis), 1, + new Particle.DustOptions(Color.RED, 1)); } if (ti >= 17) cancel(); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Weaken_Target.java b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Weaken_Target.java index 6bc71e9b..0d2ae63e 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Weaken_Target.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Weaken_Target.java @@ -26,7 +26,6 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult; import net.Indyuce.mmoitems.api.ability.TargetAbilityResult; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.stat.data.AbilityData; -import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.version.VersionSound; public class Weaken_Target extends Ability implements Listener { @@ -69,14 +68,16 @@ public class Weaken_Target extends Ability implements Listener { } for (double j = 0; j < Math.PI * 2; j += Math.PI / 18) - target.getWorld().spawnParticle(Particle.SMOKE_NORMAL, target.getLocation().clone().add(Math.cos(j) * .7, .1, Math.sin(j) * .7), 0); + target.getWorld().spawnParticle(Particle.SMOKE_NORMAL, target.getLocation().clone().add(Math.cos(j) * .7, .1, Math.sin(j) * .7), + 0); } }.runTaskTimer(MMOItems.plugin, 0, 20); } @EventHandler public void a(EntityDamageEvent event) { - if (event.getCause() != DamageCause.ENTITY_ATTACK && event.getCause() != DamageCause.ENTITY_EXPLOSION && event.getCause() != DamageCause.PROJECTILE) + if (event.getCause() != DamageCause.ENTITY_ATTACK && event.getCause() != DamageCause.ENTITY_EXPLOSION + && event.getCause() != DamageCause.PROJECTILE) return; Entity entity = event.getEntity(); @@ -106,7 +107,8 @@ public class Weaken_Target extends Ability implements Listener { for (int j = 0; j < 3; j++) { y += .07; for (int k = 0; k < 3; k++) - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(y * Math.PI + (k * Math.PI * 2 / 3)) * (3 - y) / 2.5, y, Math.sin(y * Math.PI + (k * Math.PI * 2 / 3)) * (3 - y) / 2.5), Color.BLACK); + loc.getWorld().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(y * Math.PI + (k * Math.PI * 2 / 3)) * (3 - y) / 2.5, + y, Math.sin(y * Math.PI + (k * Math.PI * 2 / 3)) * (3 - y) / 2.5), 1, new Particle.DustOptions(Color.BLACK, 1)); } if (y > 3) cancel(); diff --git a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Wither.java b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Wither.java index 51171ee8..d0c4648d 100644 --- a/src/main/java/net/Indyuce/mmoitems/ability/onhit/Wither.java +++ b/src/main/java/net/Indyuce/mmoitems/ability/onhit/Wither.java @@ -16,11 +16,11 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult; import net.Indyuce.mmoitems.api.ability.TargetAbilityResult; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.stat.data.AbilityData; -import net.mmogroup.mmolib.MMOLib; public class Wither extends Ability { public Wither() { - super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK); + super(CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, + CastingMode.SHIFT_RIGHT_CLICK); addModifier("cooldown", 8); addModifier("duration", 3); @@ -52,12 +52,13 @@ public class Wither extends Ability { double a = y * Math.PI + (j * Math.PI * 2 / 3); double x = Math.cos(a) * (3 - y) / 2.5; double z = Math.sin(a) * (3 - y) / 2.5; - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(x, x, z), Color.BLACK); + loc.getWorld().spawnParticle(Particle.REDSTONE, loc.clone().add(x, x, z), 1, new Particle.DustOptions(Color.BLACK, 1)); } } } }.runTaskTimer(MMOItems.plugin, 0, 1); target.getWorld().playSound(target.getLocation(), Sound.ENTITY_WITHER_SHOOT, 2, 2); - target.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, (int) (ability.getModifier("duration") * 20), (int) ability.getModifier("amplifier"))); + target.addPotionEffect( + new PotionEffect(PotionEffectType.WITHER, (int) (ability.getModifier("duration") * 20), (int) ability.getModifier("amplifier"))); } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/ArrowParticles.java b/src/main/java/net/Indyuce/mmoitems/api/ArrowParticles.java index 5d2946e1..573eda2e 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/ArrowParticles.java +++ b/src/main/java/net/Indyuce/mmoitems/api/ArrowParticles.java @@ -9,7 +9,6 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import net.Indyuce.mmoitems.MMOItems; -import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.api.item.NBTItem; public class ArrowParticles extends BukkitRunnable { @@ -43,8 +42,7 @@ public class ArrowParticles extends BukkitRunnable { } if (color != null) - MMOLib.plugin.getVersion().getWrapper().spawnParticle(particle, arrow.getLocation().add(0, .25, 0), amount, offset, offset, offset, 0, 1, - color); + arrow.getWorld().spawnParticle(particle, arrow.getLocation().add(0, .25, 0), amount, offset, offset, offset, color); else arrow.getWorld().spawnParticle(particle, arrow.getLocation().add(0, .25, 0), amount, offset, offset, offset, speed); } diff --git a/src/main/java/net/Indyuce/mmoitems/api/Element.java b/src/main/java/net/Indyuce/mmoitems/api/Element.java index 693fad60..c3285563 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/Element.java +++ b/src/main/java/net/Indyuce/mmoitems/api/Element.java @@ -20,7 +20,6 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.listener.ElementListener; -import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.api.DamageType; import net.mmogroup.mmolib.version.VersionMaterial; import net.mmogroup.mmolib.version.VersionSound; @@ -47,9 +46,8 @@ public enum Element { if ((y += .07) >= 3) cancel(); for (double k = 0; k < Math.PI * 2; k += Math.PI * 2 / 3) - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone() - .add(Math.cos(y * Math.PI + k) * (3 - y) / 2.5, y / 1.1, Math.sin(y * Math.PI + k) * (3 - y) / 2.5), - Color.WHITE); + loc.getWorld().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(y * Math.PI + k) * (3 - y) / 2.5, + y / 1.1, Math.sin(y * Math.PI + k) * (3 - y) / 2.5), 1, new Particle.DustOptions(Color.WHITE, 1)); } } }.runTaskTimer(MMOItems.plugin, 0, 1); @@ -80,8 +78,8 @@ public enum Element { new ElementHandler() { public void elementAttack(CachedStats stats, ItemAttackResult result, LivingEntity target, double attack, double absolute) { target.getWorld().playSound(target.getLocation(), Sound.BLOCK_GRASS_BREAK, 2, 0); - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.BLOCK_CRACK, target.getLocation().add(0, .1, 0), 64, 1, 0, 1, 0, - Material.DIRT); + target.getWorld().spawnParticle(Particle.BLOCK_CRACK, target.getLocation().add(0, .1, 0), 64, 1, 0, 1, + Material.DIRT.createBlockData()); result.addDamage(absolute); target.setVelocity(new Vector(0, 1, 0)); @@ -186,8 +184,8 @@ public enum Element { } public ElementParticle(Particle particle, float speed, int amount, Material material) { - display = (entity) -> MMOLib.plugin.getVersion().getWrapper().spawnParticle(particle, - entity.getLocation().add(0, entity.getHeight() / 2, 0), amount, 0, 0, 0, speed, material); + display = (entity) -> entity.getWorld().spawnParticle(particle, entity.getLocation().add(0, entity.getHeight() / 2, 0), amount, 0, 0, 0, + speed, material.createBlockData()); } public void displayParticle(Entity entity) { diff --git a/src/main/java/net/Indyuce/mmoitems/api/edition/NewItemEdition.java b/src/main/java/net/Indyuce/mmoitems/api/edition/NewItemEdition.java index e734c149..c0029ae7 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/edition/NewItemEdition.java +++ b/src/main/java/net/Indyuce/mmoitems/api/edition/NewItemEdition.java @@ -49,7 +49,7 @@ public class NewItemEdition implements Edition { * default chat edition feature */ new ChatEdition(this); - MMOLib.plugin.getVersion().getWrapper().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Item Creation", "See chat.", 10, 40, 10); + inv.getPlayer().sendTitle(ChatColor.GOLD + "" + ChatColor.BOLD + "Item Creation", "See chat.", 10, 40, 10); } @Override diff --git a/src/main/java/net/Indyuce/mmoitems/api/edition/StatEdition.java b/src/main/java/net/Indyuce/mmoitems/api/edition/StatEdition.java index d406dedc..36440d0a 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/edition/StatEdition.java +++ b/src/main/java/net/Indyuce/mmoitems/api/edition/StatEdition.java @@ -63,8 +63,7 @@ public class StatEdition implements Edition { * default chat edition feature */ new ChatEdition(this); - MMOLib.plugin.getVersion().getWrapper().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Item Edition", "See chat.", 10, 40, - 10); + inv.getPlayer().sendTitle(ChatColor.GOLD + "" + ChatColor.BOLD + "Item Edition", "See chat.", 10, 40, 10); } @Override 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 e86bfed1..c701a9f2 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 @@ -15,7 +15,6 @@ import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.api.ItemAttackResult; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; -import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.api.DamageType; import net.mmogroup.mmolib.api.item.NBTItem; @@ -46,11 +45,12 @@ public class ManaSpirit implements StaffAttackHandler { for (double item = 0; item < Math.PI * 2; item += Math.PI / 3.5) { Vector vec = MMOUtils.rotateFunc(new Vector(r * Math.cos(item), r * Math.sin(item), 0), loc); if (random.nextDouble() <= .6) - MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(vec), Color.AQUA); + loc.getWorld().spawnParticle(Particle.REDSTONE, loc.clone().add(vec), 1, new Particle.DustOptions(Color.AQUA, 1)); } for (Entity target : targets) if (MMOUtils.canDamage(stats.getPlayer(), loc, target)) { - new ItemAttackResult(attackDamage, DamageType.WEAPON, DamageType.MAGIC).applyEffectsAndDamage(stats, nbt, (LivingEntity) target); + new ItemAttackResult(attackDamage, DamageType.WEAPON, DamageType.MAGIC).applyEffectsAndDamage(stats, nbt, + (LivingEntity) target); loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0); cancel(); return; diff --git a/src/main/java/net/Indyuce/mmoitems/gui/edition/UpgradingEdition.java b/src/main/java/net/Indyuce/mmoitems/gui/edition/UpgradingEdition.java index 445c5c64..1586f3ed 100644 --- a/src/main/java/net/Indyuce/mmoitems/gui/edition/UpgradingEdition.java +++ b/src/main/java/net/Indyuce/mmoitems/gui/edition/UpgradingEdition.java @@ -11,6 +11,7 @@ import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.Damageable; import org.bukkit.inventory.meta.ItemMeta; import net.Indyuce.mmoitems.MMOItems; @@ -20,7 +21,6 @@ import net.Indyuce.mmoitems.api.edition.StatEdition; import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate; import net.Indyuce.mmoitems.api.item.util.NamedItemStack; import net.Indyuce.mmoitems.stat.type.ItemStat; -import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.api.util.AltChar; import net.mmogroup.mmolib.version.VersionMaterial; @@ -132,8 +132,9 @@ public class UpgradingEdition extends EditionInventory { inv.setItem(24, successItem); if (success > 0 && !template.getType().corresponds(Type.CONSUMABLE)) { - ItemStack destroyOnFail = MMOLib.plugin.getVersion().getWrapper().generate(Material.FISHING_ROD, 30); + ItemStack destroyOnFail = new ItemStack(Material.FISHING_ROD); ItemMeta destroyOnFailMeta = destroyOnFail.getItemMeta(); + ((Damageable) destroyOnFailMeta).setDamage(30); destroyOnFailMeta.setDisplayName(ChatColor.GREEN + "Destroy on fail?"); List destroyOnFailLore = new ArrayList<>(); destroyOnFailLore.add(ChatColor.GRAY + "When toggled on, the item will be"); diff --git a/src/main/java/net/Indyuce/mmoitems/stat/data/ColorData.java b/src/main/java/net/Indyuce/mmoitems/stat/data/ColorData.java index 8ae82441..fba67223 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/data/ColorData.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/data/ColorData.java @@ -47,7 +47,7 @@ public class ColorData implements StatData, RandomStatData { @Override public String toString() { - return "{red=" + red + ",green=" + green + ",blue=" + blue + "}"; + return "{Red=" + red + ",Green=" + green + ",Blue=" + blue + "}"; } @Override diff --git a/src/main/java/net/Indyuce/mmoitems/stat/data/ParticleData.java b/src/main/java/net/Indyuce/mmoitems/stat/data/ParticleData.java index 04f5ae24..94ce32ff 100644 --- a/src/main/java/net/Indyuce/mmoitems/stat/data/ParticleData.java +++ b/src/main/java/net/Indyuce/mmoitems/stat/data/ParticleData.java @@ -20,7 +20,6 @@ import net.Indyuce.mmoitems.particle.api.ParticleRunnable; import net.Indyuce.mmoitems.particle.api.ParticleType; import net.Indyuce.mmoitems.stat.data.random.RandomStatData; import net.Indyuce.mmoitems.stat.data.type.StatData; -import net.mmogroup.mmolib.MMOLib; public class ParticleData implements StatData, RandomStatData { private final ParticleType type; @@ -98,15 +97,14 @@ public class ParticleData implements StatData, RandomStatData { public void display(Location location, int amount, float offsetX, float offsetY, float offsetZ, float speed) { if (isColorable(particle)) - MMOLib.plugin.getVersion().getWrapper().spawnParticle(particle, location, amount, offsetX, offsetY, offsetZ, speed, 1, color); + location.getWorld().spawnParticle(particle, location, amount, offsetX, offsetY, offsetZ, speed, new Particle.DustOptions(color, 1)); else location.getWorld().spawnParticle(particle, location, amount, offsetX, offsetY, offsetZ, speed); } public void display(Location location, Vector direction, float speed) { if (isColorable(particle)) - MMOLib.plugin.getVersion().getWrapper().spawnParticle(particle, location, 0, direction.getX(), direction.getY(), direction.getZ(), speed, - 1, color); + location.getWorld().spawnParticle(particle, location, 0, direction.getX(), direction.getY(), direction.getZ(), speed, new Particle.DustOptions(color, 1)); else location.getWorld().spawnParticle(particle, location, 0, direction.getX(), direction.getY(), direction.getZ(), speed); }