geforkt von Mirrors/Paper
Updated Upstream (Bukkit/CraftBukkit) (#9876)
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 19830133 PR-925: Add hit entity/block to events extending ProjectileHitEvent CraftBukkit Changes: 5a72c3c04 SPIGOT-7510: Try to fix broken reflection usage of plugins 6fa69f235 PR-1281: Add hit entity/block to events extending ProjectileHitEvent 224f733ac Fix NPE introduced in #f4d977e
Dieser Commit ist enthalten in:
Ursprung
8f1cb77f10
Commit
06ac3424fa
@ -139,12 +139,12 @@ diff --git a/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java b/src/
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
- private final Map<LivingEntity, Double> affectedEntities;
|
||||
+ protected final Map<LivingEntity, Double> affectedEntities; // Paper
|
||||
|
||||
@Deprecated
|
||||
public PotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final Map<LivingEntity, Double> affectedEntities) {
|
||||
super(potion);
|
||||
|
@ -643,6 +643,41 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
|
||||
@@ -0,0 +0,0 @@ public class ProjectileHitEvent extends EntityEvent implements Cancellable {
|
||||
private final BlockFace hitFace;
|
||||
private boolean cancel = false;
|
||||
|
||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
|
||||
public ProjectileHitEvent(@NotNull final Projectile projectile) {
|
||||
- this(projectile, null, null);
|
||||
+ this(projectile, null, null, null); // Paper
|
||||
}
|
||||
|
||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
|
||||
public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity) {
|
||||
- this(projectile, hitEntity, null);
|
||||
+ this(projectile, hitEntity, null, null); // Paper
|
||||
}
|
||||
|
||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
|
||||
public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Block hitBlock) {
|
||||
- this(projectile, null, hitBlock);
|
||||
+ this(projectile, null, hitBlock, null); // Paper
|
||||
}
|
||||
|
||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
|
||||
public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity, @Nullable Block hitBlock) {
|
||||
this(projectile, hitEntity, hitBlock, null);
|
||||
}
|
||||
|
||||
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper
|
||||
public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace) {
|
||||
super(projectile);
|
||||
this.hitEntity = hitEntity;
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java b/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java
|
||||
|
@ -22,11 +22,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ showParticles = this.applyWater(); // Paper
|
||||
} else if (true || !list.isEmpty()) { // CraftBukkit - Call event even if no effects to apply
|
||||
if (this.isLingering()) {
|
||||
- this.makeAreaOfEffectCloud(itemstack, potionregistry);
|
||||
+ showParticles = this.makeAreaOfEffectCloud(itemstack, potionregistry); // Paper
|
||||
- this.makeAreaOfEffectCloud(itemstack, potionregistry, hitResult); // CraftBukkit - Pass MovingObjectPosition
|
||||
+ showParticles = this.makeAreaOfEffectCloud(itemstack, potionregistry, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper
|
||||
} else {
|
||||
- this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null);
|
||||
+ showParticles = this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null); // Paper
|
||||
- this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition
|
||||
+ showParticles = this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,8 +99,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
}
|
||||
|
||||
- private void applySplash(List<MobEffectInstance> statusEffects, @Nullable Entity entity) {
|
||||
+ private boolean applySplash(List<MobEffectInstance> statusEffects, @Nullable Entity entity) { // Paper
|
||||
- private void applySplash(List<MobEffectInstance> list, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
|
||||
+ private boolean applySplash(List<MobEffectInstance> list, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - return boolean
|
||||
AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
|
||||
List<net.minecraft.world.entity.LivingEntity> list1 = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb);
|
||||
Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit
|
||||
@ -120,16 +120,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
}
|
||||
|
||||
- private void makeAreaOfEffectCloud(ItemStack stack, Potion potion) {
|
||||
+ private boolean makeAreaOfEffectCloud(ItemStack stack, Potion potion) { // Paper
|
||||
- private void makeAreaOfEffectCloud(ItemStack itemstack, Potion potionregistry, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
|
||||
+ private boolean makeAreaOfEffectCloud(ItemStack itemstack, Potion potionregistry, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - return boolean
|
||||
AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
entityareaeffectcloud.setPotion(potion);
|
||||
Iterator iterator = PotionUtils.getCustomEffects(stack).iterator();
|
||||
entityareaeffectcloud.setPotion(potionregistry);
|
||||
Iterator iterator = PotionUtils.getCustomEffects(itemstack).iterator();
|
||||
|
||||
+ boolean noEffects = potion.getEffects().isEmpty(); // Paper
|
||||
+ boolean noEffects = potionregistry.getEffects().isEmpty(); // Paper
|
||||
while (iterator.hasNext()) {
|
||||
MobEffectInstance mobeffect = (MobEffectInstance) iterator.next();
|
||||
|
||||
@ -137,11 +137,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ noEffects = false; // Paper
|
||||
}
|
||||
|
||||
CompoundTag nbttagcompound = stack.getTag();
|
||||
CompoundTag nbttagcompound = itemstack.getTag();
|
||||
@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, entityareaeffectcloud);
|
||||
org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, position, entityareaeffectcloud);
|
||||
- if (!(event.isCancelled() || entityareaeffectcloud.isRemoved())) {
|
||||
+ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved() || (noEffects && entityareaeffectcloud.effects.isEmpty() && entityareaeffectcloud.getPotion().getEffects().isEmpty()))) { // Paper - don't spawn area effect cloud if the effects were empty and not changed during the event handling
|
||||
this.level().addFreshEntity(entityareaeffectcloud);
|
||||
|
@ -37,13 +37,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
Potion potionregistry = PotionUtils.getPotion(itemstack);
|
||||
@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
if (this.isLingering()) {
|
||||
showParticles = this.makeAreaOfEffectCloud(itemstack, potionregistry); // Paper
|
||||
showParticles = this.makeAreaOfEffectCloud(itemstack, potionregistry, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper
|
||||
} else {
|
||||
- showParticles = this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null); // Paper
|
||||
+ showParticles = this.applySplash(list, hitResult != null && hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null); // Paper - nullable hitResult
|
||||
- showParticles = this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper
|
||||
+ showParticles = this.applySplash(list, hitResult != null && hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper - nullable hitResult
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
|
||||
}
|
||||
|
||||
- private boolean applySplash(List<MobEffectInstance> list, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - return boolean
|
||||
+ private boolean applySplash(List<MobEffectInstance> list, @Nullable Entity entity, @Nullable HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - return boolean & nullable hitResult
|
||||
AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
|
||||
List<net.minecraft.world.entity.LivingEntity> list1 = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb);
|
||||
Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit
|
||||
@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
|
||||
}
|
||||
|
||||
- private boolean makeAreaOfEffectCloud(ItemStack itemstack, Potion potionregistry, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - return boolean
|
||||
+ private boolean makeAreaOfEffectCloud(ItemStack itemstack, Potion potionregistry, @Nullable HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - return boolean & nullable hitResult
|
||||
AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java
|
||||
@ -490,6 +508,57 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
/**
|
||||
* PotionSplashEvent
|
||||
*/
|
||||
- public static PotionSplashEvent callPotionSplashEvent(net.minecraft.world.entity.projectile.ThrownPotion potion, HitResult position, Map<LivingEntity, Double> affectedEntities) {
|
||||
+ public static PotionSplashEvent callPotionSplashEvent(net.minecraft.world.entity.projectile.ThrownPotion potion, @Nullable HitResult position, Map<LivingEntity, Double> affectedEntities) { // Paper - nullable hitResult
|
||||
ThrownPotion thrownPotion = (ThrownPotion) potion.getBukkitEntity();
|
||||
|
||||
Block hitBlock = null;
|
||||
BlockFace hitFace = null;
|
||||
- if (position.getType() == HitResult.Type.BLOCK) {
|
||||
+ if (position != null && position.getType() == HitResult.Type.BLOCK) { // Paper - nullable hitResult
|
||||
BlockHitResult positionBlock = (BlockHitResult) position;
|
||||
hitBlock = CraftBlock.at(potion.level(), positionBlock.getBlockPos());
|
||||
hitFace = CraftBlock.notchToBlockFace(positionBlock.getDirection());
|
||||
}
|
||||
|
||||
org.bukkit.entity.Entity hitEntity = null;
|
||||
- if (position.getType() == HitResult.Type.ENTITY) {
|
||||
+ if (position != null && position.getType() == HitResult.Type.ENTITY) { // Paper - nullable hitResult
|
||||
hitEntity = ((EntityHitResult) position).getEntity().getBukkitEntity();
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
- public static LingeringPotionSplashEvent callLingeringPotionSplashEvent(net.minecraft.world.entity.projectile.ThrownPotion potion, HitResult position, net.minecraft.world.entity.AreaEffectCloud cloud) {
|
||||
+ public static LingeringPotionSplashEvent callLingeringPotionSplashEvent(net.minecraft.world.entity.projectile.ThrownPotion potion, @Nullable HitResult position, net.minecraft.world.entity.AreaEffectCloud cloud) { // Paper - nullable hitResult
|
||||
ThrownPotion thrownPotion = (ThrownPotion) potion.getBukkitEntity();
|
||||
AreaEffectCloud effectCloud = (AreaEffectCloud) cloud.getBukkitEntity();
|
||||
|
||||
Block hitBlock = null;
|
||||
BlockFace hitFace = null;
|
||||
- if (position.getType() == HitResult.Type.BLOCK) {
|
||||
+ if (position != null && position.getType() == HitResult.Type.BLOCK) { // Paper
|
||||
BlockHitResult positionBlock = (BlockHitResult) position;
|
||||
hitBlock = CraftBlock.at(potion.level(), positionBlock.getBlockPos());
|
||||
hitFace = CraftBlock.notchToBlockFace(positionBlock.getDirection());
|
||||
}
|
||||
|
||||
org.bukkit.entity.Entity hitEntity = null;
|
||||
- if (position.getType() == HitResult.Type.ENTITY) {
|
||||
+ if (position != null && position.getType() == HitResult.Type.ENTITY) { // Paper
|
||||
hitEntity = ((EntityHitResult) position).getEntity().getBukkitEntity();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 5010ed00d3f83b7c7acbf4c1b16f7c89f309eb9a
|
||||
Subproject commit 19830133bd8e6eab082ebbc24ec58a23f16a6d1f
|
@ -1 +1 @@
|
||||
Subproject commit 75502b6ddcae5aa84b7e97fd02d2e1551afddebc
|
||||
Subproject commit 5a72c3c040c8570ba6cb2286f3bc2a5de60ee909
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren