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