Paper/Spigot-API-Patches/0013-Add-BeaconEffectEvent.patch

97 Zeilen
2.5 KiB
Diff

2015-07-24 06:41:35 +02:00
From 0a8f1851697e1c3c179be7bce30a9ca5977e3a82 Mon Sep 17 00:00:00 2001
2015-07-23 21:57:12 +02:00
From: Byteflux <byte@byteflux.net>
Date: Thu, 23 Jul 2015 11:45:20 -0700
Subject: [PATCH] Add BeaconEffectEvent
diff --git a/src/main/java/org/github/paperspigot/event/block/BeaconEffectEvent.java b/src/main/java/org/github/paperspigot/event/block/BeaconEffectEvent.java
new file mode 100644
2015-07-24 06:41:35 +02:00
index 0000000..d9f9b95
2015-07-23 21:57:12 +02:00
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/event/block/BeaconEffectEvent.java
2015-07-24 06:41:35 +02:00
@@ -0,0 +1,81 @@
2015-07-23 21:57:12 +02:00
+package org.github.paperspigot.event.block;
+
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent;
+import org.bukkit.potion.PotionEffect;
+
2015-07-24 06:41:35 +02:00
+/**
+ * Called when a beacon effect is being applied to a player.
+ */
2015-07-23 21:57:12 +02:00
+public class BeaconEffectEvent extends BlockEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled;
+ private PotionEffect effect;
+ private Player player;
+ private boolean primary;
+
+ public BeaconEffectEvent(Block block, PotionEffect effect, Player player, boolean primary) {
+ super(block);
+ this.effect = effect;
+ this.player = player;
+ this.primary = primary;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+
2015-07-24 06:41:35 +02:00
+ /**
+ * Gets the potion effect being applied.
+ *
+ * @return Potion effect
+ */
2015-07-23 21:57:12 +02:00
+ public PotionEffect getEffect() {
+ return effect;
+ }
+
2015-07-24 06:41:35 +02:00
+ /**
+ * Sets the potion effect that will be applied.
+ *
+ * @param effect Potion effect
+ */
2015-07-23 21:57:12 +02:00
+ public void setEffect(PotionEffect effect) {
+ this.effect = effect;
+ }
+
2015-07-24 06:41:35 +02:00
+ /**
+ * Gets the player who the potion effect is being applied to.
+ *
+ * @return Affected player
+ */
2015-07-23 21:57:12 +02:00
+ public Player getPlayer() {
+ return player;
+ }
+
2015-07-24 06:41:35 +02:00
+ /**
+ * Gets whether the effect is a primary beacon effect.
+ *
+ * @return true if this event represents a primary effect
+ */
2015-07-23 21:57:12 +02:00
+ public boolean isPrimary() {
+ return primary;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
1.9.5.msysgit.1