From 08bb14c3945187ecb2f9f4c15059d86bde6748aa Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sat, 29 May 2021 08:22:47 -0700 Subject: [PATCH] fix beacon activate/deactivate events (#5646) --- ...eacon-activation-deactivation-events.patch | 2 +- ...eacon-activation-deactivation-events.patch | 45 +++++++------------ 2 files changed, 16 insertions(+), 31 deletions(-) diff --git a/Spigot-API-Patches/Introduce-beacon-activation-deactivation-events.patch b/Spigot-API-Patches/Introduce-beacon-activation-deactivation-events.patch index 3816f5d302..c2c29633c0 100644 --- a/Spigot-API-Patches/Introduce-beacon-activation-deactivation-events.patch +++ b/Spigot-API-Patches/Introduce-beacon-activation-deactivation-events.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +/** + * Called when a beacon is activated. -+ * Activation occurs when the beacon activation sound is played, and the beam becomes visible. ++ * Activation occurs when the beacon beam becomes visible. + */ +public class BeaconActivatedEvent extends BlockEvent { + private static final HandlerList handlers = new HandlerList(); diff --git a/Spigot-Server-Patches/Introduce-beacon-activation-deactivation-events.patch b/Spigot-Server-Patches/Introduce-beacon-activation-deactivation-events.patch index eed632140a..802e282afd 100644 --- a/Spigot-Server-Patches/Introduce-beacon-activation-deactivation-events.patch +++ b/Spigot-Server-Patches/Introduce-beacon-activation-deactivation-events.patch @@ -8,44 +8,29 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeac index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java -@@ -0,0 +0,0 @@ import org.bukkit.potion.PotionEffect; - import org.bukkit.craftbukkit.event.CraftEventFactory; - import org.bukkit.entity.Player; - import com.destroystokyo.paper.event.block.BeaconEffectEvent; -+import io.papermc.paper.event.block.BeaconActivatedEvent; -+import io.papermc.paper.event.block.BeaconDeactivatedEvent; - // Paper end - - public class TileEntityBeacon extends TileEntity implements ITileInventory, ITickable { @@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic - boolean flag1 = this.levels > 0; - - if (!flag && flag1) { -+ // Paper start - BeaconActivatedEvent -+ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, position); -+ new BeaconActivatedEvent(block).callEvent(); -+ // Paper end - this.a(SoundEffects.BLOCK_BEACON_ACTIVATE); - Iterator iterator = this.world.a(EntityPlayer.class, (new AxisAlignedBB((double) i, (double) j, (double) k, (double) i, (double) (j - 4), (double) k)).grow(10.0D, 5.0D, 10.0D)).iterator(); - -@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic - CriterionTriggers.l.a(entityplayer, this); - } - } else if (flag && !flag1) { -+ // Paper start - BeaconDeactivatedEvent -+ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, position); -+ new BeaconDeactivatedEvent(block).callEvent(); -+ // Paper end - this.a(SoundEffects.BLOCK_BEACON_DEACTIVATE); - } + this.a(SoundEffects.BLOCK_BEACON_AMBIENT); } + } ++ // Paper start - beacon activation/deactivation events ++ if (!(i1 > 0) && this.levels > 0) { ++ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, position); ++ new io.papermc.paper.event.block.BeaconActivatedEvent(block).callEvent(); ++ } else if (i1 > 0 && !(this.levels > 0)) { ++ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, position); ++ new io.papermc.paper.event.block.BeaconDeactivatedEvent(block).callEvent(); ++ } ++ // Paper end + + if (this.i >= l) { + this.i = -1; @@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic @Override public void al_() { + // Paper start - BeaconDeactivatedEvent + org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, position); -+ new BeaconDeactivatedEvent(block).callEvent(); ++ new io.papermc.paper.event.block.BeaconDeactivatedEvent(block).callEvent(); + // Paper end this.a(SoundEffects.BLOCK_BEACON_DEACTIVATE); super.al_();