mirror of https://github.com/YatopiaMC/Yatopia.git
98 lines
2.6 KiB
Diff
98 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Fri, 5 Jul 2019 18:21:15 -0500
|
|
Subject: [PATCH] PlayerSetSpawnerTypeWithEggEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/event/PlayerSetSpawnerTypeWithEggEvent.java b/src/main/java/net/pl3x/purpur/event/PlayerSetSpawnerTypeWithEggEvent.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..c050b75e9a11ac728868fe95e3f89e6b99de6ad2
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/pl3x/purpur/event/PlayerSetSpawnerTypeWithEggEvent.java
|
|
@@ -0,0 +1,85 @@
|
|
+package net.pl3x.purpur.event;
|
|
+
|
|
+import org.bukkit.block.Block;
|
|
+import org.bukkit.block.CreatureSpawner;
|
|
+import org.bukkit.entity.EntityType;
|
|
+import org.bukkit.entity.Player;
|
|
+import org.bukkit.event.Cancellable;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.player.PlayerEvent;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+public class PlayerSetSpawnerTypeWithEggEvent extends PlayerEvent implements Cancellable {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private final Block block;
|
|
+ private final CreatureSpawner spawner;
|
|
+ private EntityType type;
|
|
+ private boolean cancel;
|
|
+
|
|
+ public PlayerSetSpawnerTypeWithEggEvent(@NotNull Player player, @NotNull Block block, @NotNull CreatureSpawner spawner, @NotNull EntityType type) {
|
|
+ super(player);
|
|
+ this.block = block;
|
|
+ this.spawner = spawner;
|
|
+ this.type = type;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Get the spawner Block in the world
|
|
+ *
|
|
+ * @return Spawner Block
|
|
+ */
|
|
+ @NotNull
|
|
+ public Block getBlock() {
|
|
+ return block;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Get the spawner state
|
|
+ *
|
|
+ * @return Spawner state
|
|
+ */
|
|
+ @NotNull
|
|
+ public CreatureSpawner getSpawner() {
|
|
+ return spawner;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the EntityType being set on the spawner
|
|
+ *
|
|
+ * @return EntityType being set
|
|
+ */
|
|
+ @NotNull
|
|
+ public EntityType getEntityType() {
|
|
+ return type;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the EntityType being set on the spawner
|
|
+ *
|
|
+ * @param type EntityType to set
|
|
+ */
|
|
+ public void setEntityType(@NotNull EntityType type) {
|
|
+ this.type = type;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCancelled() {
|
|
+ return cancel;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCancelled(boolean cancel) {
|
|
+ this.cancel = cancel;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|