diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityEnterBlockEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityEnterBlockEvent.java new file mode 100644 index 0000000000..d5bd804a58 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityEnterBlockEvent.java @@ -0,0 +1,59 @@ +package org.bukkit.event.entity; + +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; + +/** + * Called when an {@link Entity} enters a block and is stored in that block. + *
+ * This event is called for bees entering a bee hive.
+ *
+ * It is not called when a silverfish "enters" a stone block. For that listen to
+ * the {@link EntityChangeBlockEvent}.
+ */
+public class EntityEnterBlockEvent extends EntityEvent implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final Block block;
+ private boolean cancel;
+
+ public EntityEnterBlockEvent(@NotNull final Entity entity, @NotNull final Block block) {
+ super(entity);
+
+ this.block = block;
+ }
+
+ /**
+ * Get the block the entity will enter.
+ *
+ * @return the block
+ */
+ @NotNull
+ public Block getBlock() {
+ return block;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}