117 - Create custom events -- adding an API of sorts to MobCatcher

What steps will reproduce the problem?
There is no problem, just a lack of custom event calls, which to my understanding would allow another plugin to control Mobcatcher in a small way

What is the expected output? What do you see instead?
I would like to help if I can in suggesting and coding a couple custom events, which should allow another plugin I'm developing to use MobCatcher to provide details on mobs captured and released.

Please provide any additional information below.
A couple custom events is what I'd suggest first: An event called MobCatcherMobPrereleaseFromEggEvent. This will be raised after throwing the egg, right before the mob is released. If the event is cancelled, the egg still remains, waiting to be picked up again. The event should have methods getPlayer() and getMobType() and getSpawnerEgg().

Another event should be called right after the mob has been released from the egg: MobCatcherMobReleasedFromEggEvent. this event should not be cancellable, as the Prerelease event is intended to allow another plugin to stop MobCatcher from releasing the mob. This event should have events getPlayer() and getMob() (type LivingEntity). This will allow my plugin, for example, to know who "owns" a released mob.

Two similar events should be called for Pre-catching and post-catching a mob.
MobCatcherPrecatchMobEvent -> cancel-able. methods getPlayer() and getMob()
MobCatcherCaughtMobEvent -> NOT cancel-able. methods getPlayer() and getMobType() and getSpawnerEgg()

User When Change
Malikk65 Mar 23, 2014 at 09:11 UTC Changed status from Started to Declined
Malikk65 Jun 25, 2013 at 18:40 UTC Changed status from New to Started
lochnessduck Jun 25, 2013 at 14:50 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of lochnessduck lochnessduck Jun 29, 2013 at 22:17 UTC - 0 likes

    Excellent, you've probably got a bigger handle on the methods that are needed. And Doh! Silly me for thinking that you'd have to have pre-events :P

    One quick suggestion, On the MobcSpawnEvent, I'm assuming this is triggered either after the spawnEgg has been thrown, or if the player tried to spawn the mob on a nearby block. If you also include a

    getSpawnEggItem (Item),

    then that gives the programmer control over what happens to the egg if the event is cancelled. If the player were spawning the mob on a nearby block, it would return null (or so I think), but otherwise would return the egg item that had been thrown, but that did not release the mob. I intend to use such a feature to allow only the player who threw the egg to pick up the egg.

    in the same idea, another method

    isProjectileSpawn() (Boolean)

    would mirror the capture event, and be a little more concise than checking if an item is null

  • Avatar of Malikk65 Malikk65 Jun 25, 2013 at 18:40 UTC - 1 like

    I've been trying to figure out how to add support for some region protection plugins and other things myself, but I suppose if I add a simple API then it's someone else's problem, lol. I'm happy to add this in.

    There's no point to having any pre events. You would use the normal event on monitor priority and check if it was cancelled OR on a higher priority and cancel it yourself; that would give you the same two functionalities.

    I'll add in events

    • extends cancellable
    • getPlayer() (Player)
    • getMob() (LivingEntity)


    • extends cancellable
    • getPlayer() (Player)
    • getMob() (LivingEntity)
    • isProjectileCapture() (Boolean)
    • getSpawnEggItemStack() (ItemStack)
    • getSpawnEggItem() (Item)

    [MobCatcher Logo] Check out my plugins on SpigotMC! MobCatcher and EpicGlass now for 1.9 [MobCatcher Logo]



Last updated
Mar 23, 2014
Jun 25, 2013
Declined - We decided not to take action on this ticket.
Enhancement - A change which is intended to better the project in some way
Medium - Normal priority.

Reported by

Possible assignees