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

45 lines
1000 B
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[]
{
C.cGray + "You heal " + recover + "HP when you kill someone",
});
_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);
}
}