mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: df0d7b0d Update upstream CB 6ea3c2cf [CI-SKIP] Rebuild patches d7bed4cb Heavily optimise random block ticking (#2914) b66d9ff8 Update upstream CB ba71c5d6 Stop stripping private use block Unicode from signs 28d9dcfc Entity Jump API (#1587) 9976a768 Fix PlayerNaturallySpawnCreaturesEvent boolean inversion 054e20da Clean up imports on ThrownEggHatchEvent a8984ccb Add ThrownEggHatchEvent (#1982) 9f24d495 Allow nerfed blazes, endermen to take water damage (#2847)
87 lines
2.4 KiB
Diff
87 lines
2.4 KiB
Diff
From f9b7f2c2980f030dac545c5968f53ff0336919ee 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 00000000..983d6723
|
|
--- /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
|
|
|