mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 16:05:01 +00:00
Few Fixes (#578)
* Few Fixes • Fixed BendingDisplay bar not updating for unbound moves • Fixed NCP NPE - Thanks RoboMWM for pointing this out! * Fixed null check
This commit is contained in:
parent
7ed5bcd01b
commit
749669e84c
2 changed files with 12 additions and 11 deletions
|
@ -1415,12 +1415,10 @@ public class PKListener implements Listener {
|
|||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||
int slot = event.getNewSlot() + 1;
|
||||
|
||||
if (bPlayer.getAbilities().get(slot) != null ) {
|
||||
if (bPlayer != null && bPlayer.getAbilities() != null) {
|
||||
CoreAbility ability = CoreAbility.getAbility(bPlayer.getAbilities().get(slot));
|
||||
if (ability != null) {
|
||||
GeneralMethods.displayMovePreview(player, ability);
|
||||
}
|
||||
}
|
||||
|
||||
WaterArms waterArms = CoreAbility.getAbility(player, WaterArms.class);
|
||||
if (waterArms != null) {
|
||||
|
|
|
@ -28,10 +28,13 @@ public class DamageHandler {
|
|||
@SuppressWarnings("deprecation")
|
||||
public static void damageEntity(Entity entity, Player source, double damage, Ability ability, boolean ignoreArmor) {
|
||||
|
||||
if (ability == null)
|
||||
if (ability == null) {
|
||||
return;
|
||||
}
|
||||
if (source == null) {
|
||||
source = ability.getPlayer();
|
||||
}
|
||||
|
||||
Player player = ability.getPlayer();
|
||||
AbilityDamageEntityEvent damageEvent = new AbilityDamageEntityEvent(entity, ability, damage, ignoreArmor);
|
||||
Bukkit.getServer().getPluginManager().callEvent(damageEvent);
|
||||
if (entity instanceof LivingEntity) {
|
||||
|
@ -40,8 +43,8 @@ public class DamageHandler {
|
|||
}
|
||||
if (!damageEvent.isCancelled()) {
|
||||
damage = damageEvent.getDamage();
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus")) {
|
||||
NCPExemptionManager.exemptPermanently(player, CheckType.FIGHT_REACH);
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus") && source != null) {
|
||||
NCPExemptionManager.exemptPermanently(source, CheckType.FIGHT_REACH);
|
||||
}
|
||||
|
||||
if(((LivingEntity) entity).getHealth() - damage <= 0 && !entity.isDead()) {
|
||||
|
@ -54,15 +57,15 @@ public class DamageHandler {
|
|||
cause = DamageCause.MAGIC;
|
||||
}
|
||||
|
||||
EntityDamageByEntityEvent finalEvent = new EntityDamageByEntityEvent(player, entity, cause, damage);
|
||||
EntityDamageByEntityEvent finalEvent = new EntityDamageByEntityEvent(source, entity, cause, damage);
|
||||
if (!finalEvent.isCancelled()) {
|
||||
damage = finalEvent.getDamage();
|
||||
((LivingEntity) entity).damage(damage, source);
|
||||
entity.setLastDamageCause(finalEvent);
|
||||
}
|
||||
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus")) {
|
||||
NCPExemptionManager.unexempt(player);
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus") && source != null) {
|
||||
NCPExemptionManager.unexempt(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue