Mineplex2018-withcommit/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkVampire.java

45 lines
1.0 KiB
Java
Raw Normal View History

2013-08-27 17:14:08 +02:00
package nautilus.game.arcade.kit.perks;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.kit.Perk;
public class PerkVampire extends Perk
{
private int _recover;
public PerkVampire(int recover)
{
super("Vampire", new String[]
{
2015-07-28 06:15:41 +02:00
C.cGray + "You heal " + C.cYellow + recover + " Hearts" + C.cGray + " when you kill someone",
2013-08-27 17:14:08 +02:00
});
_recover = recover;
}
@EventHandler
public void PlayerKillAward(CombatDeathEvent event)
{
Game game = Manager.GetGame();
if (game == null) return;
if (!(event.GetEvent().getEntity() instanceof Player))
return;
if (event.GetLog().GetKiller() == null)
return;
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer == null)
return;
UtilPlayer.health(killer, _recover);
}
}