!Removed 1.12 deprecated methods

This commit is contained in:
Indyuce 2020-08-12 16:34:41 +02:00
parent be9aa9ceea
commit 790ebd09a7
20 changed files with 78 additions and 68 deletions

Binary file not shown.

View File

@ -22,7 +22,8 @@ import net.mmogroup.mmolib.version.VersionSound;
public class Contamination extends Ability { public class Contamination extends Ability {
public Contamination() { 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("damage", 2);
addModifier("duration", 8); addModifier("duration", 8);
@ -35,7 +36,7 @@ public class Contamination extends Ability {
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) { public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
return new LocationAbilityResult(ability, stats.getPlayer(), target); return new LocationAbilityResult(ability, stats.getPlayer(), target);
} }
@Override @Override
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) { public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
Location loc = ((LocationAbilityResult) ability).getTarget(); Location loc = ((LocationAbilityResult) ability).getTarget();
@ -53,7 +54,8 @@ public class Contamination extends Ability {
if (j >= duration) if (j >= duration)
cancel(); 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++) { for (int j = 0; j < 3; j++) {
ti += Math.PI / 32; ti += Math.PI / 32;
double r = Math.sin(ti / 2) * 4; 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); loc.getWorld().playSound(loc, VersionSound.ENTITY_ENDERMAN_HURT.toSound(), 2, 1);
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc)) for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) <= 25) 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); }.runTaskTimer(MMOItems.plugin, 0, 1);

View File

@ -15,14 +15,14 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult;
import net.Indyuce.mmoitems.api.ability.LocationAbilityResult; import net.Indyuce.mmoitems.api.ability.LocationAbilityResult;
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.stat.data.AbilityData;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.api.AttackResult; import net.mmogroup.mmolib.api.AttackResult;
import net.mmogroup.mmolib.api.DamageType; import net.mmogroup.mmolib.api.DamageType;
import net.mmogroup.mmolib.version.VersionSound; import net.mmogroup.mmolib.version.VersionSound;
public class Corrupt extends Ability { public class Corrupt extends Ability {
public Corrupt() { 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("damage", 8);
addModifier("duration", 4); 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); Location loc1 = loc.clone().add(Math.cos(j) * radius, 1, Math.sin(j) * radius);
double y_max = .5 + random.nextDouble(); double y_max = .5 + random.nextDouble();
for (double y = 0; y < y_max; y += .1) 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)) for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))

View File

@ -21,14 +21,14 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult;
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult; import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.stat.data.AbilityData;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.api.AttackResult; import net.mmogroup.mmolib.api.AttackResult;
import net.mmogroup.mmolib.api.DamageType; import net.mmogroup.mmolib.api.DamageType;
import net.mmogroup.mmolib.version.VersionSound; import net.mmogroup.mmolib.version.VersionSound;
public class Ice_Crystal extends Ability { public class Ice_Crystal extends Ability {
public Ice_Crystal() { 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("damage", 6);
addModifier("duration", 3); addModifier("duration", 3);
@ -70,9 +70,10 @@ public class Ice_Crystal extends Ability {
*/ */
for (double r = 0; r < .4; r += .1) for (double r = 0; r < .4; r += .1)
for (double a = 0; a < Math.PI * 2; a += Math.PI / 2) { 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); 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)); 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.EXPLOSION_LARGE, loc, 0);
loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 48, 0, 0, 0, .2); loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 48, 0, 0, 0, .2);
loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 2, 1); 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); new AttackResult(ability.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE)
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (ability.getModifier("duration") * 20), (int) ability.getModifier("amplifier"))); .damage(stats.getPlayer(), (LivingEntity) entity);
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW,
(int) (ability.getModifier("duration") * 20), (int) ability.getModifier("amplifier")));
cancel(); cancel();
return; return;
} }

View File

@ -19,12 +19,12 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult;
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult; import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.stat.data.AbilityData;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.version.VersionSound; import net.mmogroup.mmolib.version.VersionSound;
public class Magical_Shield extends Ability { public class Magical_Shield extends Ability {
public Magical_Shield() { 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("power", 40);
addModifier("radius", 5); 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 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))) 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));
} }
} }
} }

View File

@ -21,11 +21,11 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult;
import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult; import net.Indyuce.mmoitems.api.ability.SimpleAbilityResult;
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.stat.data.AbilityData;
import net.mmogroup.mmolib.MMOLib;
public class Shockwave extends Ability { public class Shockwave extends Ability {
public Shockwave() { 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("cooldown", 7.5);
addModifier("knock-up", 1); addModifier("knock-up", 1);
@ -58,10 +58,11 @@ public class Shockwave extends Ability {
loc.add(vec); loc.add(vec);
loc.getWorld().playSound(loc, Sound.BLOCK_GRAVEL_BREAK, 1, 2); 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)) 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()); hit.add(ent.getEntityId());
ent.playEffect(EntityEffect.HURT); ent.playEffect(EntityEffect.HURT);
ent.setVelocity(ent.getVelocity().setY(.4 * knockUp)); ent.setVelocity(ent.getVelocity().setY(.4 * knockUp));

View File

@ -23,7 +23,6 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult;
import net.Indyuce.mmoitems.api.ability.VectorAbilityResult; import net.Indyuce.mmoitems.api.ability.VectorAbilityResult;
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.stat.data.AbilityData;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.api.AttackResult; import net.mmogroup.mmolib.api.AttackResult;
import net.mmogroup.mmolib.api.DamageType; import net.mmogroup.mmolib.api.DamageType;
import net.mmogroup.mmolib.api.item.NBTItem; import net.mmogroup.mmolib.api.item.NBTItem;
@ -121,8 +120,8 @@ public class Shulker_Missile extends Ability implements Listener {
y += .04; y += .04;
for (int j = 0; j < 2; j++) { for (int j = 0; j < 2; j++) {
double xz = y * Math.PI * 1.3 + (j * Math.PI); 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)), loc.getWorld().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(xz), y, Math.sin(xz)), 1,
Color.MAROON); new Particle.DustOptions(Color.MAROON, 1));
} }
} }
if (y >= 2) if (y >= 2)

View File

@ -15,12 +15,12 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult;
import net.Indyuce.mmoitems.api.ability.TargetAbilityResult; import net.Indyuce.mmoitems.api.ability.TargetAbilityResult;
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.stat.data.AbilityData;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.version.VersionSound; import net.mmogroup.mmolib.version.VersionSound;
public class Blind extends Ability { public class Blind extends Ability {
public Blind() { 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("duration", 5);
addModifier("cooldown", 9); addModifier("cooldown", 9);
@ -28,7 +28,6 @@ public class Blind extends Ability {
addModifier("stamina", 0); addModifier("stamina", 0);
} }
@Override @Override
public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) { public AbilityResult whenRan(CachedStats stats, LivingEntity target, AbilityData ability, ItemAttackResult result) {
return new TargetAbilityResult(ability, stats.getPlayer(), target); return new TargetAbilityResult(ability, stats.getPlayer(), target);
@ -37,13 +36,14 @@ public class Blind extends Ability {
@Override @Override
public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) { public void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result) {
LivingEntity target = ((TargetAbilityResult) ability).getTarget(); LivingEntity target = ((TargetAbilityResult) ability).getTarget();
target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_ENDERMAN_HURT.toSound(), 1, 2); 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 i = 0; i < Math.PI * 2; i += Math.PI / 24)
for (double j = 0; j < 2; j++) { for (double j = 0; j < 2; j++) {
Location loc = target.getLocation(); 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()); Vector vec = MMOUtils.rotateFunc(new Vector(Math.cos(i), 1 + Math.cos(i + (Math.PI * j)) * .5, Math.sin(i)),
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.add(vec), Color.BLACK); 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)); target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, (int) (ability.getModifier("duration") * 20), 0));
} }

View File

@ -16,11 +16,11 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult;
import net.Indyuce.mmoitems.api.ability.TargetAbilityResult; import net.Indyuce.mmoitems.api.ability.TargetAbilityResult;
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.stat.data.AbilityData;
import net.mmogroup.mmolib.MMOLib;
public class Slow extends Ability { public class Slow extends Ability {
public Slow() { 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("cooldown", 5);
addModifier("duration", 3); 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 j = 0; j < Math.PI * 2; j += Math.PI)
for (double r = 0; r < .7; r += .1) 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); }.runTaskTimer(MMOItems.plugin, 0, 1);
target.getWorld().playSound(target.getLocation(), Sound.ENTITY_LLAMA_ANGRY, 1, 2); 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")));
} }
} }

View File

@ -15,11 +15,11 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult;
import net.Indyuce.mmoitems.api.ability.TargetAbilityResult; import net.Indyuce.mmoitems.api.ability.TargetAbilityResult;
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.stat.data.AbilityData;
import net.mmogroup.mmolib.MMOLib;
public class Vampirism extends Ability { public class Vampirism extends Ability {
public Vampirism() { 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("cooldown", 8);
addModifier("drain", 10); addModifier("drain", 10);
@ -47,7 +47,9 @@ public class Vampirism extends Ability {
dis += ti <= 10 ? .15 : -.15; dis += ti <= 10 ? .15 : -.15;
for (double j = 0; j < Math.PI * 2; j += Math.PI / 4) 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) if (ti >= 17)
cancel(); cancel();

View File

@ -26,7 +26,6 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult;
import net.Indyuce.mmoitems.api.ability.TargetAbilityResult; import net.Indyuce.mmoitems.api.ability.TargetAbilityResult;
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.stat.data.AbilityData;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.version.VersionSound; import net.mmogroup.mmolib.version.VersionSound;
public class Weaken_Target extends Ability implements Listener { 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) 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); }.runTaskTimer(MMOItems.plugin, 0, 20);
} }
@EventHandler @EventHandler
public void a(EntityDamageEvent event) { 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; return;
Entity entity = event.getEntity(); Entity entity = event.getEntity();
@ -106,7 +107,8 @@ public class Weaken_Target extends Ability implements Listener {
for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) {
y += .07; y += .07;
for (int k = 0; k < 3; k++) 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) if (y > 3)
cancel(); cancel();

View File

@ -16,11 +16,11 @@ import net.Indyuce.mmoitems.api.ability.AbilityResult;
import net.Indyuce.mmoitems.api.ability.TargetAbilityResult; import net.Indyuce.mmoitems.api.ability.TargetAbilityResult;
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
import net.Indyuce.mmoitems.stat.data.AbilityData; import net.Indyuce.mmoitems.stat.data.AbilityData;
import net.mmogroup.mmolib.MMOLib;
public class Wither extends Ability { public class Wither extends Ability {
public Wither() { 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("cooldown", 8);
addModifier("duration", 3); addModifier("duration", 3);
@ -52,12 +52,13 @@ public class Wither extends Ability {
double a = y * Math.PI + (j * Math.PI * 2 / 3); double a = y * Math.PI + (j * Math.PI * 2 / 3);
double x = Math.cos(a) * (3 - y) / 2.5; double x = Math.cos(a) * (3 - y) / 2.5;
double z = Math.sin(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); }.runTaskTimer(MMOItems.plugin, 0, 1);
target.getWorld().playSound(target.getLocation(), Sound.ENTITY_WITHER_SHOOT, 2, 2); 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")));
} }
} }

View File

@ -9,7 +9,6 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOItems;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.api.item.NBTItem; import net.mmogroup.mmolib.api.item.NBTItem;
public class ArrowParticles extends BukkitRunnable { public class ArrowParticles extends BukkitRunnable {
@ -43,8 +42,7 @@ public class ArrowParticles extends BukkitRunnable {
} }
if (color != null) if (color != null)
MMOLib.plugin.getVersion().getWrapper().spawnParticle(particle, arrow.getLocation().add(0, .25, 0), amount, offset, offset, offset, 0, 1, arrow.getWorld().spawnParticle(particle, arrow.getLocation().add(0, .25, 0), amount, offset, offset, offset, color);
color);
else else
arrow.getWorld().spawnParticle(particle, arrow.getLocation().add(0, .25, 0), amount, offset, offset, offset, speed); arrow.getWorld().spawnParticle(particle, arrow.getLocation().add(0, .25, 0), amount, offset, offset, offset, speed);
} }

View File

@ -20,7 +20,6 @@ import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.MMOUtils;
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
import net.Indyuce.mmoitems.listener.ElementListener; import net.Indyuce.mmoitems.listener.ElementListener;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.api.DamageType; import net.mmogroup.mmolib.api.DamageType;
import net.mmogroup.mmolib.version.VersionMaterial; import net.mmogroup.mmolib.version.VersionMaterial;
import net.mmogroup.mmolib.version.VersionSound; import net.mmogroup.mmolib.version.VersionSound;
@ -47,9 +46,8 @@ public enum Element {
if ((y += .07) >= 3) if ((y += .07) >= 3)
cancel(); cancel();
for (double k = 0; k < Math.PI * 2; k += Math.PI * 2 / 3) for (double k = 0; k < Math.PI * 2; k += Math.PI * 2 / 3)
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone() loc.getWorld().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(y * Math.PI + k) * (3 - y) / 2.5,
.add(Math.cos(y * Math.PI + k) * (3 - y) / 2.5, y / 1.1, Math.sin(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));
Color.WHITE);
} }
} }
}.runTaskTimer(MMOItems.plugin, 0, 1); }.runTaskTimer(MMOItems.plugin, 0, 1);
@ -80,8 +78,8 @@ public enum Element {
new ElementHandler() { new ElementHandler() {
public void elementAttack(CachedStats stats, ItemAttackResult result, LivingEntity target, double attack, double absolute) { public void elementAttack(CachedStats stats, ItemAttackResult result, LivingEntity target, double attack, double absolute) {
target.getWorld().playSound(target.getLocation(), Sound.BLOCK_GRASS_BREAK, 2, 0); 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, target.getWorld().spawnParticle(Particle.BLOCK_CRACK, target.getLocation().add(0, .1, 0), 64, 1, 0, 1,
Material.DIRT); Material.DIRT.createBlockData());
result.addDamage(absolute); result.addDamage(absolute);
target.setVelocity(new Vector(0, 1, 0)); target.setVelocity(new Vector(0, 1, 0));
@ -186,8 +184,8 @@ public enum Element {
} }
public ElementParticle(Particle particle, float speed, int amount, Material material) { public ElementParticle(Particle particle, float speed, int amount, Material material) {
display = (entity) -> MMOLib.plugin.getVersion().getWrapper().spawnParticle(particle, display = (entity) -> entity.getWorld().spawnParticle(particle, entity.getLocation().add(0, entity.getHeight() / 2, 0), amount, 0, 0, 0,
entity.getLocation().add(0, entity.getHeight() / 2, 0), amount, 0, 0, 0, speed, material); speed, material.createBlockData());
} }
public void displayParticle(Entity entity) { public void displayParticle(Entity entity) {

View File

@ -49,7 +49,7 @@ public class NewItemEdition implements Edition {
* default chat edition feature * default chat edition feature
*/ */
new ChatEdition(this); 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 @Override

View File

@ -63,8 +63,7 @@ public class StatEdition implements Edition {
* default chat edition feature * default chat edition feature
*/ */
new ChatEdition(this); new ChatEdition(this);
MMOLib.plugin.getVersion().getWrapper().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Item Edition", "See chat.", 10, 40, inv.getPlayer().sendTitle(ChatColor.GOLD + "" + ChatColor.BOLD + "Item Edition", "See chat.", 10, 40, 10);
10);
} }
@Override @Override

View File

@ -15,7 +15,6 @@ import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.MMOUtils; import net.Indyuce.mmoitems.MMOUtils;
import net.Indyuce.mmoitems.api.ItemAttackResult; import net.Indyuce.mmoitems.api.ItemAttackResult;
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats; import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.api.DamageType; import net.mmogroup.mmolib.api.DamageType;
import net.mmogroup.mmolib.api.item.NBTItem; 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) { 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); Vector vec = MMOUtils.rotateFunc(new Vector(r * Math.cos(item), r * Math.sin(item), 0), loc);
if (random.nextDouble() <= .6) 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) for (Entity target : targets)
if (MMOUtils.canDamage(stats.getPlayer(), loc, target)) { 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); loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0);
cancel(); cancel();
return; return;

View File

@ -11,6 +11,7 @@ import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import net.Indyuce.mmoitems.MMOItems; 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.template.MMOItemTemplate;
import net.Indyuce.mmoitems.api.item.util.NamedItemStack; import net.Indyuce.mmoitems.api.item.util.NamedItemStack;
import net.Indyuce.mmoitems.stat.type.ItemStat; import net.Indyuce.mmoitems.stat.type.ItemStat;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.api.util.AltChar; import net.mmogroup.mmolib.api.util.AltChar;
import net.mmogroup.mmolib.version.VersionMaterial; import net.mmogroup.mmolib.version.VersionMaterial;
@ -132,8 +132,9 @@ public class UpgradingEdition extends EditionInventory {
inv.setItem(24, successItem); inv.setItem(24, successItem);
if (success > 0 && !template.getType().corresponds(Type.CONSUMABLE)) { 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(); ItemMeta destroyOnFailMeta = destroyOnFail.getItemMeta();
((Damageable) destroyOnFailMeta).setDamage(30);
destroyOnFailMeta.setDisplayName(ChatColor.GREEN + "Destroy on fail?"); destroyOnFailMeta.setDisplayName(ChatColor.GREEN + "Destroy on fail?");
List<String> destroyOnFailLore = new ArrayList<>(); List<String> destroyOnFailLore = new ArrayList<>();
destroyOnFailLore.add(ChatColor.GRAY + "When toggled on, the item will be"); destroyOnFailLore.add(ChatColor.GRAY + "When toggled on, the item will be");

View File

@ -47,7 +47,7 @@ public class ColorData implements StatData, RandomStatData {
@Override @Override
public String toString() { public String toString() {
return "{red=" + red + ",green=" + green + ",blue=" + blue + "}"; return "{Red=" + red + ",Green=" + green + ",Blue=" + blue + "}";
} }
@Override @Override

View File

@ -20,7 +20,6 @@ import net.Indyuce.mmoitems.particle.api.ParticleRunnable;
import net.Indyuce.mmoitems.particle.api.ParticleType; import net.Indyuce.mmoitems.particle.api.ParticleType;
import net.Indyuce.mmoitems.stat.data.random.RandomStatData; import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
import net.Indyuce.mmoitems.stat.data.type.StatData; import net.Indyuce.mmoitems.stat.data.type.StatData;
import net.mmogroup.mmolib.MMOLib;
public class ParticleData implements StatData, RandomStatData { public class ParticleData implements StatData, RandomStatData {
private final ParticleType type; 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) { public void display(Location location, int amount, float offsetX, float offsetY, float offsetZ, float speed) {
if (isColorable(particle)) 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 else
location.getWorld().spawnParticle(particle, location, amount, offsetX, offsetY, offsetZ, speed); location.getWorld().spawnParticle(particle, location, amount, offsetX, offsetY, offsetZ, speed);
} }
public void display(Location location, Vector direction, float speed) { public void display(Location location, Vector direction, float speed) {
if (isColorable(particle)) if (isColorable(particle))
MMOLib.plugin.getVersion().getWrapper().spawnParticle(particle, location, 0, direction.getX(), direction.getY(), direction.getZ(), speed, location.getWorld().spawnParticle(particle, location, 0, direction.getX(), direction.getY(), direction.getZ(), speed, new Particle.DustOptions(color, 1));
1, color);
else else
location.getWorld().spawnParticle(particle, location, 0, direction.getX(), direction.getY(), direction.getZ(), speed); location.getWorld().spawnParticle(particle, location, 0, direction.getX(), direction.getY(), direction.getZ(), speed);
} }