spawnedby: parameters - trying to hook other plugin spawns
israelcurtis opened this issue ยท 10 comments
so this new 2.8 beta feature --
spawnedby: [NATURAL, CUSTOM, SPAWNEGG, -OTHERDROPS])
(why does otherdrops have a dash before it?)
when i noticed that the mobs spawned by my other major plugin, MobManager (http://dev.bukkit.org/server-mods/mobmanager/) were not triggering the MOBSPAWN action, I wondered if the "spawnedby" parameter could help. But "Custom" doesn't seem to work, and i'm not even sure what it refers to.
how can we listen for other plugins spawn events?
I've added the following to the 2.8 beta features page:
- Add "spawnedby" condition (eg. spawnedby: [NATURAL, CUSTOM, SPAWNEGG, -OTHERDROPS])
- Mobs spawned by a plugin are "CUSTOM" unless they support OtherDrops (eg. setMetaData("CreatureSpawnedBy", new FixedMetadataValue(plugin, "[reason]");)
- Add new trigger - action: MOBSPAWN (will run the drop-section if this mob spawns).
- "CUSTOM" spawns are disabled unless explicity enabled in the config - this is to avoid infinite loops (eg. zombie spawns zombie spawns zombie, etc).
The dash before otherdrops means "not" otherdrops - not really relevant in that example but more so by itself, eg.
spawnedby: -otherdrops # means any spawn reason except by otherdrops.
action: MOBSPAWN -- wasn't this already been on the parameters page for a while? http://dev.bukkit.org/server-mods/otherdrops/pages/parameters/
At least, I've been using it since I found otherdrops ;-)
Not seeing something in the config about 'CUSTOM' spawns? assuming my spawnedby: CUSTOM didn't work because i didn't have it allowed somehow?
as for third-party support - where is the documentation for this (the API page is empty)?
setMetaData("CreatureSpawnedBy", new FixedMetadataValue(plugin, "<reason>");)
It's a relatively new feature, only in the recent 2.8 beta's - didn't think the docs for it were on the parameters page yet.
2.8beta's have been going a while now as I've made some big changes (see http://dev.bukkit.org/server-mods/otherdrops/pages/2-8-beta-features/) and want to make sure everything's settled before releasing, hence also no API information yet.
If you've ever seen an infinite loop of zombies crash the server and client you'll know why I blocked custom drops :) Having said that though I've just hammered away at it and came up with a way to tell that the spawn was from OtherDrops. Using this I can now safely just ignore OtherDrops mob spawns and allow other plugins custom spawns.
I deliberately left the config option out of the config file as it was too easy to create an infinite loop. It's still left out and is even less useful now that it's only ignoring OtherDrops spawns (however if you really want to allow them it's "spawntrigger_ignores_otherdrops_spawn" - set to false and be careful not to create infinite loops).
Fix: MOBSPAWN now only ignores OtherDrops spawns rather than all custom spawns.
See 8e4c44a
actually - just tried a spawnreason: CUSTOM event, and used mobmanager to spawn some endermen, and my console flipped out (hundreds of these):
2013-03-28 13:58:47 [SEVERE] Could not pass event CreatureSpawnEvent to OtherDrops v2.8b.412
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:427)
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:39)
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:479)
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:464)
at org.bukkit.craftbukkit.v1_5_R2.event.CraftEventFactory.callCreatureSpawnEvent(CraftEventFactory.java:230)
at net.minecraft.server.v1_5_R2.World.addEntity(World.java:950)
at org.bukkit.craftbukkit.v1_5_R2.CraftWorld.spawn(CraftWorld.java:1142)
at org.bukkit.craftbukkit.v1_5_R2.CraftWorld.spawn(CraftWorld.java:916)
at org.bukkit.craftbukkit.v1_5_R2.CraftWorld.spawnEntity(CraftWorld.java:463)
at com.gmail.zariust.otherdrops.drop.DropType.dropCreatureWithRider(DropType.java:209)
at com.gmail.zariust.otherdrops.drop.CreatureDrop.performDrop(CreatureDrop.java:106)
at com.gmail.zariust.otherdrops.drop.DropType.dropLocal(DropType.java:147)
at com.gmail.zariust.otherdrops.drop.DropListExclusive.performDrop(DropListExclusive.java:92)
at com.gmail.zariust.otherdrops.drop.DropType.dropLocal(DropType.java:147)
at com.gmail.zariust.otherdrops.drop.DropType.drop(DropType.java:127)
at com.gmail.zariust.otherdrops.event.DropRunner.run(DropRunner.java:113)
at com.gmail.zariust.otherdrops.OtherDrops.scheduleDrop(OtherDrops.java:438)
at com.gmail.zariust.otherdrops.OtherDrops.performDrop(OtherDrops.java:239)
at com.gmail.zariust.otherdrops.listener.OdSpawnListener.onCreatureSpawn(OdSpawnListener.java:59)
at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:39)
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:479)
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:464)
at
actually - i've removed the spawnedby: CUSTOM line, and I'm still getting this massive spam anytime I do anything, even opening a chest...
using v2.8b.412. I think i'm using build #47
i downgraded to 2.8b.382 to avoid the issue.
https://gist.github.com/somaticstudios/636fc3710db86375a18f#file-aftermath-master-yml
A flaw in my infinite loop protection meant that every enderman dropped an enderman which triggered the same mobspawn to drop another enderman, etc.
Fixed in 5e64197 (dev build 51).