mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-09-11 04:39:32 +00:00
Merge remote-tracking branch 'refs/remotes/ProjectKorra/master'
This commit is contained in:
commit
b9ddf9360e
|
@ -93,6 +93,7 @@ import com.projectkorra.projectkorra.command.Commands;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthBlast;
|
import com.projectkorra.projectkorra.earthbending.EarthBlast;
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthPassive;
|
import com.projectkorra.projectkorra.earthbending.EarthPassive;
|
||||||
|
import com.projectkorra.projectkorra.event.BendingDamageEvent;
|
||||||
import com.projectkorra.projectkorra.event.BendingReloadEvent;
|
import com.projectkorra.projectkorra.event.BendingReloadEvent;
|
||||||
import com.projectkorra.projectkorra.event.BindChangeEvent;
|
import com.projectkorra.projectkorra.event.BindChangeEvent;
|
||||||
import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
|
import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
|
||||||
|
@ -371,6 +372,8 @@ public class GeneralMethods {
|
||||||
EntityBendingDeathEvent event = new EntityBendingDeathEvent(entity, player, damage, ability);
|
EntityBendingDeathEvent event = new EntityBendingDeathEvent(entity, player, damage, ability);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
}
|
}
|
||||||
|
BendingDamageEvent event = new BendingDamageEvent();
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
((LivingEntity) entity).damage(damage, player);
|
((LivingEntity) entity).damage(damage, player);
|
||||||
entity.setLastDamageCause(new EntityDamageByEntityEvent(player, entity, DamageCause.CUSTOM, damage));
|
entity.setLastDamageCause(new EntityDamageByEntityEvent(player, entity, DamageCause.CUSTOM, damage));
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus")) {
|
if (Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus")) {
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.projectkorra.projectkorra.event;
|
||||||
|
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
public class BendingDamageEvent extends Event implements Cancellable {
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
public BendingDamageEvent() {
|
||||||
|
this.cancelled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancelled = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -36,22 +36,20 @@ public class HealingWaters extends HealingAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void heal(Player player) {
|
private static void heal(Player player) {
|
||||||
if (inWater(player)) {
|
if (inWater(player)) {
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
Entity entity = GeneralMethods.getTargetedEntity(player, getRadius());
|
Entity entity = GeneralMethods.getTargetedEntity(player, getRadius());
|
||||||
if (entity instanceof LivingEntity && inWater(entity)) {
|
if (entity == null) {
|
||||||
if (getShiftRequired() && player.isSneaking()) {
|
giveHP(player);
|
||||||
giveHPToEntity((LivingEntity) entity);
|
} else {
|
||||||
} else if (!getShiftRequired()) {
|
giveHPToEntity((LivingEntity) entity);
|
||||||
giveHPToEntity((LivingEntity) entity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (getShiftRequired() && player.isSneaking()) {
|
if (getShiftRequired()) {
|
||||||
giveHP(player);
|
return;
|
||||||
} else if (!getShiftRequired()) {
|
} else {
|
||||||
giveHP(player);
|
giveHP(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue