mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 12:11:47 +01:00
e4d10a6d67
Upstream has released updates that appears 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: 122289ff Add FaceAttachable interface to handle Grindstone facing in common with Switches a6db750e SPIGOT-5647: ZombieVillager entity should have getVillagerType() CraftBukkit Changes:bbe3d58e
SPIGOT-5650: Lectern.setPage(int) causes a NullPointerException3075579f
Add FaceAttachable interface to handle Grindstone facing in common with Switches95bd4238
SPIGOT-5647: ZombieVillager entity should have getVillagerType()4d975ac3
SPIGOT-5617: setBlockData does not work when NotPlayEvent is called by redstone current
71 lines
3.1 KiB
Diff
71 lines
3.1 KiB
Diff
From 5ac25a0ea16c5596da57d29a473fad1488b70b6b Mon Sep 17 00:00:00 2001
|
|
From: Byteflux <byte@byteflux.net>
|
|
Date: Wed, 2 Mar 2016 23:30:53 -0600
|
|
Subject: [PATCH] Add BeaconEffectEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
|
|
index 536afe5312..df2d6c3b07 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
|
|
@@ -14,6 +14,11 @@ import org.bukkit.craftbukkit.potion.CraftPotionUtil;
|
|
import org.bukkit.entity.HumanEntity;
|
|
import org.bukkit.potion.PotionEffect;
|
|
// CraftBukkit end
|
|
+// Paper start
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.entity.Player;
|
|
+import com.destroystokyo.paper.event.block.BeaconEffectEvent;
|
|
+// Paper end
|
|
|
|
public class TileEntityBeacon extends TileEntity implements ITileInventory, ITickable {
|
|
|
|
@@ -242,14 +247,31 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic
|
|
}
|
|
|
|
private void applyEffect(List list, MobEffectList effects, int i, int b0) {
|
|
+ // Paper - BeaconEffectEvent
|
|
+ applyEffect(list, effects, i, b0, true);
|
|
+ }
|
|
+
|
|
+ private void applyEffect(List list, MobEffectList effects, int i, int b0, boolean isPrimary) {
|
|
+ // Paper - BeaconEffectEvent
|
|
{
|
|
Iterator iterator = list.iterator();
|
|
|
|
EntityHuman entityhuman;
|
|
|
|
+ // Paper start - BeaconEffectEvent
|
|
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
|
+ PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffect(effects, i, b0, true, true));
|
|
+ // Paper end
|
|
+
|
|
while (iterator.hasNext()) {
|
|
entityhuman = (EntityHuman) iterator.next();
|
|
- entityhuman.addEffect(new MobEffect(effects, i, b0, true, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
|
+
|
|
+ // Paper start - BeaconEffectEvent
|
|
+ BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (Player) entityhuman.getBukkitEntity(), isPrimary);
|
|
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
|
|
+ PotionEffect eventEffect = event.getEffect();
|
|
+ entityhuman.addEffect(new MobEffect(MobEffectList.fromId(eventEffect.getType().getId()), eventEffect.getDuration(), eventEffect.getAmplifier(), true, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
|
+ // Paper end
|
|
}
|
|
}
|
|
}
|
|
@@ -272,10 +294,10 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic
|
|
int i = getLevel();
|
|
List list = getHumansInRange();
|
|
|
|
- applyEffect(list, this.primaryEffect, i, b0);
|
|
+ applyEffect(list, this.primaryEffect, i, b0, true); // Paper - BeaconEffectEvent
|
|
|
|
if (hasSecondaryEffect()) {
|
|
- applyEffect(list, this.secondaryEffect, i, 0);
|
|
+ applyEffect(list, this.secondaryEffect, i, 0, false); // Paper - BeaconEffectEvent
|
|
}
|
|
}
|
|
|
|
--
|
|
2.25.1
|
|
|