Tweaked spider smash

This commit is contained in:
xGamingDudex 2016-10-20 01:01:46 +02:00
parent 2306dbc909
commit 82f1ec1ac6

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.smash.perks.spider;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -10,6 +11,9 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import com.sun.xml.internal.fastinfoset.algorithm.HexadecimalEncodingAlgorithm;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
@ -64,7 +68,7 @@ public class SmashSpider extends SmashUltimate
} }
// Regen // Regen
Manager.GetCondition().Factory().Regen(GetName(), player, player, DURATION / 1000, 0, false, false, false); Manager.GetCondition().Factory().Regen(GetName(), player, player, DURATION / 1000, 2, false, false, false);
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
@ -140,7 +144,6 @@ public class SmashSpider extends SmashUltimate
} }
damager.setMaxHealth(Math.min(30, damager.getMaxHealth() + diff)); damager.setMaxHealth(Math.min(30, damager.getMaxHealth() + diff));
damager.setHealth(Math.min(damagee.getMaxHealth(), damager.getHealth() + diff));
UtilParticle.PlayParticle(ParticleType.HEART, damager.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); UtilParticle.PlayParticle(ParticleType.HEART, damager.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers());
@ -151,4 +154,19 @@ public class SmashSpider extends SmashUltimate
damager.getWorld().playSound(damager.getLocation(), Sound.SPIDER_IDLE, 1.5f, 1f); damager.getWorld().playSound(damager.getLocation(), Sound.SPIDER_IDLE, 1.5f, 1f);
} }
} }
@EventHandler(priority = EventPriority.HIGHEST)
public void onRegen(EntityRegainHealthEvent event)
{
if(!(event.getEntity() instanceof Player)) return;
Player p = (Player) event.getEntity();
if(!hasPerk(p))
{
return;
}
Bukkit.broadcastMessage("Regen: " + p.getName() + " - " + event.getRegainReason().name() + " - " + event.getAmount() + " " + event.isCancelled());
}
} }