mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: b75eeca0 Boost light task priority to ensure it doesnt hold up chunk loads 3d2bc848 Ensure VillagerTrades doesn't load async - fixes #3495 e470f1ef Add more information to Timing Reports f4a47db6 Improve Thread Pool usage to allow single threads for single cpu servers a4fe910f Fix sounds when using worldedit regen command 70ad51a8 Updated Upstream (Bukkit/CraftBukkit) d7cfa4fa Improve legacy format serialization more
87 lines
2.4 KiB
Diff
87 lines
2.4 KiB
Diff
From c90d5a3d7fc8dc2449b778807b42e18de51f3641 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Sat, 19 Oct 2019 03:20:49 -0500
|
|
Subject: [PATCH] Add MonsterEggSpawnEvent
|
|
|
|
---
|
|
.../event/entity/MonsterEggSpawnEvent.java | 67 +++++++++++++++++++
|
|
1 file changed, 67 insertions(+)
|
|
create mode 100644 src/main/java/net/pl3x/purpur/event/entity/MonsterEggSpawnEvent.java
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/event/entity/MonsterEggSpawnEvent.java b/src/main/java/net/pl3x/purpur/event/entity/MonsterEggSpawnEvent.java
|
|
new file mode 100644
|
|
index 000000000..983d67234
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/pl3x/purpur/event/entity/MonsterEggSpawnEvent.java
|
|
@@ -0,0 +1,67 @@
|
|
+package net.pl3x.purpur.event.entity;
|
|
+
|
|
+import org.bukkit.entity.HumanEntity;
|
|
+import org.bukkit.entity.LivingEntity;
|
|
+import org.bukkit.entity.Player;
|
|
+import org.bukkit.event.Cancellable;
|
|
+import org.bukkit.event.Event;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.inventory.ItemStack;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+import org.jetbrains.annotations.Nullable;
|
|
+
|
|
+public class MonsterEggSpawnEvent extends Event implements Cancellable {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private boolean canceled;
|
|
+
|
|
+ private final Player player;
|
|
+ private LivingEntity entity;
|
|
+ private final ItemStack item;
|
|
+
|
|
+ public MonsterEggSpawnEvent(@Nullable HumanEntity player, @NotNull LivingEntity entity, @NotNull ItemStack item) {
|
|
+ this.player = (Player) player;
|
|
+ this.entity = entity;
|
|
+ this.item = item;
|
|
+ }
|
|
+
|
|
+ @Nullable
|
|
+ public Player getPlayer() {
|
|
+ return player;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public LivingEntity getEntity() {
|
|
+ return entity;
|
|
+ }
|
|
+
|
|
+ public void setEntity(@Nullable LivingEntity entity) {
|
|
+ if (entity == null) {
|
|
+ canceled = true;
|
|
+ return;
|
|
+ }
|
|
+ this.entity = entity;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public ItemStack getItem() {
|
|
+ return item;
|
|
+ }
|
|
+
|
|
+ public boolean isCancelled() {
|
|
+ return canceled;
|
|
+ }
|
|
+
|
|
+ public void setCancelled(boolean cancel) {
|
|
+ canceled = cancel;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|
|
--
|
|
2.24.0
|
|
|