Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
67 Zeilen
3.5 KiB
Diff
67 Zeilen
3.5 KiB
Diff
From 6acc3fe86bba094e83297ba49c93452aa01cd4d1 Mon Sep 17 00:00:00 2001
|
|
From: Byteflux <byte@byteflux.net>
|
|
Date: Thu, 23 Apr 2015 17:26:21 -0400
|
|
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 4f280dd..f4717af 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
|
|
@@ -10,6 +10,14 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
|
import org.bukkit.entity.HumanEntity;
|
|
// CraftBukkit end
|
|
|
|
+// PaperSpigot start
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.entity.Player;
|
|
+import org.bukkit.potion.PotionEffect;
|
|
+import org.bukkit.potion.PotionEffectType;
|
|
+import org.github.paperspigot.event.block.BeaconEffectEvent;
|
|
+// PaperSpigot end
|
|
+
|
|
public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlayerListBox, IInventory {
|
|
|
|
public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffectList.FASTER_MOVEMENT, MobEffectList.FASTER_DIG}, { MobEffectList.RESISTANCE, MobEffectList.JUMP}, { MobEffectList.INCREASE_DAMAGE}, { MobEffectList.REGENERATION}};
|
|
@@ -76,18 +84,35 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay
|
|
Iterator iterator = list.iterator();
|
|
|
|
EntityHuman entityhuman;
|
|
+ // PaperSpigot start
|
|
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
|
+ PotionEffect primaryEffect = new PotionEffect(PotionEffectType.getById(this.k), 180, b0, true, true);
|
|
+ // PaperSpigot end
|
|
|
|
while (iterator.hasNext()) {
|
|
entityhuman = (EntityHuman) iterator.next();
|
|
- entityhuman.addEffect(new MobEffect(this.k, 180, b0, true, true));
|
|
+ // PaperSpigot start - BeaconEffectEvent
|
|
+ BeaconEffectEvent event = new BeaconEffectEvent(block, primaryEffect, (Player) entityhuman.getBukkitEntity(), true);
|
|
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
|
|
+
|
|
+ PotionEffect effect = event.getEffect();
|
|
+ entityhuman.addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
|
|
+ // PaperSpigot end
|
|
}
|
|
|
|
if (this.j >= 4 && this.k != this.l && this.l > 0) {
|
|
iterator = list.iterator();
|
|
+ PotionEffect secondaryEffect = new PotionEffect(PotionEffectType.getById(this.l), 180, 0, true, true); // PaperSpigot
|
|
|
|
while (iterator.hasNext()) {
|
|
entityhuman = (EntityHuman) iterator.next();
|
|
- entityhuman.addEffect(new MobEffect(this.l, 180, 0, true, true));
|
|
+ // PaperSpigot start - BeaconEffectEvent
|
|
+ BeaconEffectEvent event = new BeaconEffectEvent(block, secondaryEffect, (Player) entityhuman.getBukkitEntity(), false);
|
|
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
|
|
+
|
|
+ PotionEffect effect = event.getEffect();
|
|
+ entityhuman.addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
|
|
+ // PaperSpigot end
|
|
}
|
|
}
|
|
}
|
|
--
|
|
2.6.0
|
|
|