From 360de7c4dc995bef26a51dd217651ac93e7f3c14 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 21 Nov 2016 17:02:11 -0500 Subject: [PATCH] EMC MonsterEggSpawn Events --- .../customevents/MonsterEggSpawnEvent.java | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/main/java/com/empireminecraft/customevents/MonsterEggSpawnEvent.java diff --git a/src/main/java/com/empireminecraft/customevents/MonsterEggSpawnEvent.java b/src/main/java/com/empireminecraft/customevents/MonsterEggSpawnEvent.java new file mode 100644 index 00000000..cb54d6d5 --- /dev/null +++ b/src/main/java/com/empireminecraft/customevents/MonsterEggSpawnEvent.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016. Starlis LLC / dba Empire Minecraft + * + * This source code is proprietary software and must not be redistributed without Starlis LLC's approval + * + */ + +package com.empireminecraft.customevents; + + +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; + +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(HumanEntity player, LivingEntity entity, ItemStack item) { + this.player = (Player) player; + this.entity = entity; + this.item = item; + } + + public Player getPlayer() { + return player; + } + + public LivingEntity getEntity() { + return entity; + } + + public void setEntity(LivingEntity entity) { + if (entity == null) { + canceled = true; + return; + } + this.entity = entity; + } + + public ItemStack getItem() { + return item; + } + + public boolean isCancelled() { + return canceled; + } + + public void setCancelled(boolean cancel) { + canceled = cancel; + } + + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } + +} -- 2.25.1.windows.1