mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Update for modifierFunctions
This commit is contained in:
parent
94a566acc9
commit
d2d70089ca
@ -5,12 +5,14 @@ import java.util.Map;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when mcMMO applies damage from an entity due to special abilities.
|
* Called when mcMMO applies damage from an entity due to special abilities.
|
||||||
*/
|
*/
|
||||||
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
|
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
|
||||||
public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
|
public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers, final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
|
||||||
super(damager, damagee, cause, modifiers);
|
super(damager, damagee, cause, modifiers, modifierFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -5,12 +5,14 @@ import java.util.Map;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when mcMMO applies damage due to special abilities.
|
* Called when mcMMO applies damage due to special abilities.
|
||||||
*/
|
*/
|
||||||
public class FakeEntityDamageEvent extends EntityDamageEvent {
|
public class FakeEntityDamageEvent extends EntityDamageEvent {
|
||||||
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
|
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers, final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
|
||||||
super(damagee, cause, modifiers);
|
super(damagee, cause, modifiers, modifierFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -614,7 +614,7 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static double callFakeDamageEvent(Entity attacker, Entity target, DamageCause cause, Map<DamageModifier, Double> modifiers) {
|
public static double callFakeDamageEvent(Entity attacker, Entity target, DamageCause cause, Map<DamageModifier, Double> modifiers) {
|
||||||
EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, cause, modifiers) : new FakeEntityDamageByEntityEvent(attacker, target, cause, modifiers);
|
EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, cause, modifiers, null) : new FakeEntityDamageByEntityEvent(attacker, target, cause, modifiers, null);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
|
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
|
||||||
|
|
||||||
if (damageEvent.isCancelled()) {
|
if (damageEvent.isCancelled()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user