Only call one Death Penalty Event

This commit is contained in:
riking 2013-11-10 12:42:08 -08:00 committed by TfT_02
parent 4b402d9837
commit 56b57da077
2 changed files with 13 additions and 14 deletions

View File

@ -140,6 +140,12 @@ public class PlayerListener implements Listener {
Player killer = killedPlayer.getKiller(); Player killer = killedPlayer.getKiller();
if (statLossEnabled || (killer != null && vampirismEnabled)) {
if (EventUtils.callDeathPenaltyEvent(killedPlayer).isCancelled()) {
return;
}
if (killer != null && vampirismEnabled) { if (killer != null && vampirismEnabled) {
HardcoreManager.invokeVampirism(killer, killedPlayer); HardcoreManager.invokeVampirism(killer, killedPlayer);
} }
@ -148,6 +154,7 @@ public class PlayerListener implements Listener {
HardcoreManager.invokeStatPenalty(killedPlayer); HardcoreManager.invokeStatPenalty(killedPlayer);
} }
} }
}
/** /**
* Monitor PlayerChangedWorldEvents. * Monitor PlayerChangedWorldEvents.

View File

@ -14,10 +14,6 @@ public final class HardcoreManager {
public static void invokeStatPenalty(Player player) { public static void invokeStatPenalty(Player player) {
double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage(); double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage();
if (EventUtils.callDeathPenaltyEvent(player).isCancelled()) {
return;
}
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile(); PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
int totalLevelsLost = 0; int totalLevelsLost = 0;
@ -49,10 +45,6 @@ public final class HardcoreManager {
public static void invokeVampirism(Player killer, Player victim) { public static void invokeVampirism(Player killer, Player victim) {
double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage(); double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage();
if (EventUtils.callDeathPenaltyEvent(victim).isCancelled()) {
return;
}
PlayerProfile killerProfile = UserManager.getPlayer(killer).getProfile(); PlayerProfile killerProfile = UserManager.getPlayer(killer).getProfile();
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile(); PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
int totalLevelsStolen = 0; int totalLevelsStolen = 0;