Fix BeaconEffectEvent
It is no longer 5 am
This commit is contained in:
@@ -27,9 +27,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
+// Paper start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.potion.CraftPotionUtil;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.potion.PotionData;
|
||||
+import org.bukkit.potion.PotionEffect;
|
||||
+import org.bukkit.potion.PotionEffectType;
|
||||
+import com.destroystokyo.paper.event.block.BeaconEffectEvent;
|
||||
+// Paper end
|
||||
+
|
||||
@@ -42,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
+ // Paper start
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||
+ PotionEffect primaryEffect = new PotionEffect(PotionEffectType.getByName(this.l.e), 180, b0, true, true);
|
||||
+ PotionEffect primaryEffect = CraftPotionUtil.toBukkit(new MobEffect(this.l, i, b0, true, true));
|
||||
+ // Paper end
|
||||
+
|
||||
while (iterator.hasNext()) {
|
||||
@@ -52,13 +53,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ BeaconEffectEvent event = new BeaconEffectEvent(block, primaryEffect, (Player) entityhuman.getBukkitEntity(), true);
|
||||
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
|
||||
+ PotionEffect effect = event.getEffect();
|
||||
+ entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
|
||||
+ entityhuman.getBukkitEntity().addPotionEffect(effect);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
if (this.k >= 4 && this.l != this.m && this.m != null) {
|
||||
iterator = list.iterator();
|
||||
+ PotionEffect secondaryEffect = new PotionEffect(PotionEffectType.getByName(this.m.e), 180, 0, true, true); // Paper
|
||||
+ PotionEffect secondaryEffect = org.bukkit.craftbukkit.potion.CraftPotionUtil.toBukkit(new MobEffect(this.m, i, 0, true, true)); // Paper
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
entityhuman = (EntityHuman) iterator.next();
|
||||
@@ -67,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ BeaconEffectEvent event = new BeaconEffectEvent(block, secondaryEffect, (Player) entityhuman.getBukkitEntity(), false);
|
||||
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
|
||||
+ PotionEffect effect = event.getEffect();
|
||||
+ entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
|
||||
+ entityhuman.getBukkitEntity().addPotionEffect(effect);
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user