Fix Meridian Scepter not damaging the victim (would just give the wither effect)

This commit is contained in:
Ben 2016-04-10 15:23:43 +01:00
parent fe89a5b68e
commit 9a2f4a8936

View File

@ -20,6 +20,7 @@ import mineplex.core.common.util.RGBData;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilCollections;
import mineplex.core.common.util.UtilColor;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
@ -38,6 +39,8 @@ public class MeridianScepter extends LegendaryItem
private RGBData[] colors = { UtilColor.RgbPurple, UtilColor.RgbPurple.Lighten(), UtilColor.RgbPurple.Darken() };
private int _witherDamageTimes = 5;
public MeridianScepter()
{
super("Meridian Scepter", UtilText.splitLinesToArray(new String[] {
@ -80,7 +83,6 @@ public class MeridianScepter extends LegendaryItem
final Vector direction = shooter.getEyeLocation().getDirection().normalize().multiply(0.25);
final int maxRange = 50;
final int maxDings = maxRange * 4;
final int damage = 6;
UtilServer.repeat(new BukkitRunnable()
{
@ -101,11 +103,18 @@ public class MeridianScepter extends LegendaryItem
// If they are less than 0.5 blocks away
if (eLoc.clone().add(0, player.getEyeHeight() / 2, 0).distance(projectile) <= 0.7)
{
ClansManager.getInstance().getDamageManager().NewDamageEvent(player, player, null,
DamageCause.CUSTOM, damage, true, true, false,
player.getName(), "Meridian Scepter");
player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 20 * _witherDamageTimes, 0));
player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 20 * 4, 0));
int time = 0;
for (int i = 0; i < _witherDamageTimes; i++)
{
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(UtilServer.getPlugin(), () -> {
ClansManager.getInstance().getDamageManager().NewDamageEvent(player, shooter, null,
DamageCause.CUSTOM, 2, false, true, true,
shooter.getName(), "Meridian Scepter");
}, ++time * 20);
}
UtilPlayer.message(player, F.main("Clans", F.elem(player.getName()) + " hit you with a " + F.elem("Meridian Scepter") + C.mBody + "."));
UtilPlayer.message(shooter, F.main("Clans", "You hit " + F.elem(player.getName()) + " with your " + F.elem("Meridian Scepter") + C.mBody + "."));