mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-08-16 08:26:29 +00:00
- Changed PlayerBendingDeathEvent to EntityBendingDeathEvent
This commit is contained in:
parent
2953a7b921
commit
4ac4a2f646
|
@ -95,7 +95,7 @@ import com.projectkorra.projectkorra.earthbending.EarthBlast;
|
|||
import com.projectkorra.projectkorra.earthbending.EarthPassive;
|
||||
import com.projectkorra.projectkorra.event.BendingReloadEvent;
|
||||
import com.projectkorra.projectkorra.event.BindingUpdateEvent;
|
||||
import com.projectkorra.projectkorra.event.PlayerBendingDeathEvent;
|
||||
import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
|
||||
import com.projectkorra.projectkorra.firebending.Combustion;
|
||||
import com.projectkorra.projectkorra.firebending.FireBlast;
|
||||
import com.projectkorra.projectkorra.firebending.FireCombo;
|
||||
|
@ -367,8 +367,8 @@ public class GeneralMethods {
|
|||
if (Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus")) {
|
||||
NCPExemptionManager.exemptPermanently(player, CheckType.FIGHT_REACH);
|
||||
}
|
||||
if (((LivingEntity) entity).getHealth() - damage <= 0 && entity instanceof Player && !entity.isDead()) {
|
||||
PlayerBendingDeathEvent event = new PlayerBendingDeathEvent((Player) entity, player, damage, ability);
|
||||
if (((LivingEntity) entity).getHealth() - damage <= 0 && !entity.isDead()) {
|
||||
EntityBendingDeathEvent event = new EntityBendingDeathEvent(entity, player, damage, ability);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
((LivingEntity) entity).damage(damage, player);
|
||||
|
|
|
@ -54,8 +54,8 @@ import com.projectkorra.projectkorra.earthbending.RaiseEarthWall;
|
|||
import com.projectkorra.projectkorra.earthbending.SandSpout;
|
||||
import com.projectkorra.projectkorra.earthbending.Shockwave;
|
||||
import com.projectkorra.projectkorra.earthbending.Tremorsense;
|
||||
import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
|
||||
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
|
||||
import com.projectkorra.projectkorra.event.PlayerBendingDeathEvent;
|
||||
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
|
||||
import com.projectkorra.projectkorra.firebending.Blaze;
|
||||
import com.projectkorra.projectkorra.firebending.BlazeArc;
|
||||
|
@ -694,8 +694,8 @@ public class PKListener implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerBendingDeath(PlayerBendingDeathEvent event) {
|
||||
if (ConfigManager.deathMsgConfig.get().getBoolean("Properties.Enabled")) {
|
||||
public void onPlayerBendingDeath(EntityBendingDeathEvent event) {
|
||||
if (ConfigManager.deathMsgConfig.get().getBoolean("Properties.Enabled") && event.getVictim() instanceof Player) {
|
||||
CoreAbility ability = CoreAbility.getAbility(event.getAbility());
|
||||
|
||||
if (ability == null) {
|
||||
|
@ -705,8 +705,8 @@ public class PKListener implements Listener {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(ability.getElement().getColor());
|
||||
sb.append(event.getAbility());
|
||||
BENDING_PLAYER_DEATH.put(event.getVictim(), sb.toString());
|
||||
final Player player = event.getVictim();
|
||||
BENDING_PLAYER_DEATH.put((Player) event.getVictim(), sb.toString());
|
||||
final Player player = (Player) event.getVictim();
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
|
|
|
@ -1,77 +1,77 @@
|
|||
package com.projectkorra.projectkorra.event;
|
||||
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player is killed by {@link GeneralMethods#damageEntity(Player player, Entity entity, double damage, String ability) GeneralMethods.damageEntity}
|
||||
*
|
||||
* @author kingbirdy
|
||||
*/
|
||||
|
||||
public class PlayerBendingDeathEvent extends Event {
|
||||
|
||||
public static final HandlerList handlers = new HandlerList();
|
||||
private Player victim;
|
||||
private Player attacker;
|
||||
private String ability;
|
||||
private double damage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param victim the player who died
|
||||
* @param attacker the player who killed the victim
|
||||
* @param damage the amount of damage done in the attack that killed the victim
|
||||
* @param ability the ability used to kill the victim
|
||||
*/
|
||||
public PlayerBendingDeathEvent(Player victim, Player attacker, double damage, String ability) {
|
||||
this.victim = victim;
|
||||
this.attacker = attacker;
|
||||
this.ability = ability;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the player who was killed
|
||||
*/
|
||||
public Player getVictim() {
|
||||
return victim;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the player who killed the victim
|
||||
*/
|
||||
public Player getAttacker() {
|
||||
return attacker;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the ability used to kill the victim
|
||||
*/
|
||||
public String getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the amount of damage done in the attack that killed the victim
|
||||
*/
|
||||
public double getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
package com.projectkorra.projectkorra.event;
|
||||
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player is killed by {@link GeneralMethods#damageEntity(Player player, Entity entity, double damage, String ability) GeneralMethods.damageEntity}
|
||||
*
|
||||
* @author kingbirdy
|
||||
*/
|
||||
|
||||
public class EntityBendingDeathEvent extends Event {
|
||||
|
||||
public static final HandlerList handlers = new HandlerList();
|
||||
private Entity victim;
|
||||
private Player attacker;
|
||||
private String ability;
|
||||
private double damage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param victim the player who died
|
||||
* @param attacker the player who killed the victim
|
||||
* @param damage the amount of damage done in the attack that killed the victim
|
||||
* @param ability the ability used to kill the victim
|
||||
*/
|
||||
public EntityBendingDeathEvent(Entity victim, Player attacker, double damage, String ability) {
|
||||
this.victim = victim;
|
||||
this.attacker = attacker;
|
||||
this.ability = ability;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the player who was killed
|
||||
*/
|
||||
public Entity getVictim() {
|
||||
return victim;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the player who killed the victim
|
||||
*/
|
||||
public Player getAttacker() {
|
||||
return attacker;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the ability used to kill the victim
|
||||
*/
|
||||
public String getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the amount of damage done in the attack that killed the victim
|
||||
*/
|
||||
public double getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue