2020-05-02 06:03:47 +08:00
|
|
|
From ad5e2c1dff96cd282de8d908b8d35a90b04daf29 Mon Sep 17 00:00:00 2001
|
2015-07-24 03:57:12 +08:00
|
|
|
From: Byteflux <byte@byteflux.net>
|
2016-03-01 07:09:49 +08:00
|
|
|
Date: Mon, 29 Feb 2016 18:09:40 -0600
|
2015-07-24 03:57:12 +08:00
|
|
|
Subject: [PATCH] Add BeaconEffectEvent
|
|
|
|
|
|
|
|
|
2016-03-01 07:09:49 +08:00
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
2015-07-24 03:57:12 +08:00
|
|
|
new file mode 100644
|
2020-04-03 05:07:06 +08:00
|
|
|
index 000000000..978813b94
|
2015-07-24 03:57:12 +08:00
|
|
|
--- /dev/null
|
2016-03-01 07:09:49 +08:00
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
2019-03-20 08:28:15 +08:00
|
|
|
@@ -0,0 +1,86 @@
|
2016-03-01 07:09:49 +08:00
|
|
|
+package com.destroystokyo.paper.event.block;
|
2015-07-24 03:57:12 +08:00
|
|
|
+
|
|
|
|
+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;
|
2019-03-20 08:28:15 +08:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
2015-07-24 03:57:12 +08:00
|
|
|
+
|
2015-07-24 12:41:35 +08:00
|
|
|
+/**
|
|
|
|
+ * Called when a beacon effect is being applied to a player.
|
|
|
|
+ */
|
2015-07-24 03:57:12 +08: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;
|
|
|
|
+
|
2019-03-20 08:28:15 +08:00
|
|
|
+ public BeaconEffectEvent(@NotNull Block block, @NotNull PotionEffect effect, @NotNull Player player, boolean primary) {
|
2015-07-24 03:57:12 +08:00
|
|
|
+ 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 12:41:35 +08:00
|
|
|
+ /**
|
|
|
|
+ * Gets the potion effect being applied.
|
|
|
|
+ *
|
|
|
|
+ * @return Potion effect
|
|
|
|
+ */
|
2019-03-20 08:28:15 +08:00
|
|
|
+ @NotNull
|
2015-07-24 03:57:12 +08:00
|
|
|
+ public PotionEffect getEffect() {
|
|
|
|
+ return effect;
|
|
|
|
+ }
|
|
|
|
+
|
2015-07-24 12:41:35 +08:00
|
|
|
+ /**
|
|
|
|
+ * Sets the potion effect that will be applied.
|
|
|
|
+ *
|
|
|
|
+ * @param effect Potion effect
|
|
|
|
+ */
|
2019-03-20 08:28:15 +08:00
|
|
|
+ public void setEffect(@NotNull PotionEffect effect) {
|
2015-07-24 03:57:12 +08:00
|
|
|
+ this.effect = effect;
|
|
|
|
+ }
|
|
|
|
+
|
2015-07-24 12:41:35 +08:00
|
|
|
+ /**
|
|
|
|
+ * Gets the player who the potion effect is being applied to.
|
|
|
|
+ *
|
|
|
|
+ * @return Affected player
|
|
|
|
+ */
|
2019-03-20 08:28:15 +08:00
|
|
|
+ @NotNull
|
2015-07-24 03:57:12 +08:00
|
|
|
+ public Player getPlayer() {
|
|
|
|
+ return player;
|
|
|
|
+ }
|
|
|
|
+
|
2015-07-24 12:41:35 +08:00
|
|
|
+ /**
|
|
|
|
+ * Gets whether the effect is a primary beacon effect.
|
|
|
|
+ *
|
|
|
|
+ * @return true if this event represents a primary effect
|
|
|
|
+ */
|
2015-07-24 03:57:12 +08:00
|
|
|
+ public boolean isPrimary() {
|
|
|
|
+ return primary;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 08:28:15 +08:00
|
|
|
+ @NotNull
|
2015-07-24 03:57:12 +08:00
|
|
|
+ @Override
|
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 08:28:15 +08:00
|
|
|
+ @NotNull
|
2015-07-24 03:57:12 +08:00
|
|
|
+ public static HandlerList getHandlerList() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
--
|
2020-05-02 06:03:47 +08:00
|
|
|
2.26.2
|
2015-07-24 03:57:12 +08:00
|
|
|
|