mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
#925: Add hit entity/block to events extending ProjectileHitEvent
By: Jishuna <joshl5324@gmail.com>
This commit is contained in:
parent
d257d03a16
commit
3475839dd7
3 changed files with 29 additions and 3 deletions
|
@ -1,8 +1,12 @@
|
|||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.ThrownExpBottle;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called when a ThrownExpBottle hits and releases experience.
|
||||
|
@ -12,8 +16,13 @@ public class ExpBottleEvent extends ProjectileHitEvent {
|
|||
private int exp;
|
||||
private boolean showEffect = true;
|
||||
|
||||
@Deprecated
|
||||
public ExpBottleEvent(@NotNull final ThrownExpBottle bottle, final int exp) {
|
||||
super(bottle);
|
||||
this(bottle, null, null, null, exp);
|
||||
}
|
||||
|
||||
public ExpBottleEvent(@NotNull final ThrownExpBottle bottle, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace, final int exp) {
|
||||
super(bottle, hitEntity, hitBlock, hitFace);
|
||||
this.exp = exp;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.AreaEffectCloud;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called when a splash potion hits an area
|
||||
|
@ -14,8 +18,13 @@ public class LingeringPotionSplashEvent extends ProjectileHitEvent implements Ca
|
|||
private boolean cancelled;
|
||||
private final AreaEffectCloud entity;
|
||||
|
||||
@Deprecated
|
||||
public LingeringPotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final AreaEffectCloud entity) {
|
||||
super(potion);
|
||||
this(potion, null, null, null, entity);
|
||||
}
|
||||
|
||||
public LingeringPotionSplashEvent(@NotNull final ThrownPotion potion, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace, @NotNull final AreaEffectCloud entity) {
|
||||
super(potion, hitEntity, hitBlock, hitFace);
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,11 +4,15 @@ import com.google.common.base.Preconditions;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called when a splash potion hits an area
|
||||
|
@ -18,9 +22,13 @@ public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable
|
|||
private boolean cancelled;
|
||||
private final Map<LivingEntity, Double> affectedEntities;
|
||||
|
||||
@Deprecated
|
||||
public PotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final Map<LivingEntity, Double> affectedEntities) {
|
||||
super(potion);
|
||||
this(potion, null, null, null, affectedEntities);
|
||||
}
|
||||
|
||||
public PotionSplashEvent(@NotNull final ThrownPotion potion, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace, @NotNull final Map<LivingEntity, Double> affectedEntities) {
|
||||
super(potion, hitEntity, hitBlock, hitFace);
|
||||
this.affectedEntities = affectedEntities;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue