DiabloDrops
DiabloDrops copied to clipboard
Probable bug with RuinGenerateEvent
When listening to RuinGenerateEvent to edit the loot inside the chests, I encountered some trouble. So I added some debug messages and I noticed how:
event.getChest().getType()
returns Material.AIR
, I'd expect that it would return Material.CHEST
So it would appear that event.getChest() is getting the wrong block.
Using Jenkins dev build: https://diabloplugins.ci.cloudbees.com/job/DiabloDrops/7/
After doing more tests, I noticed that the coordinates are actually correct. Does this event get called before the chest gets generated?
It does get called before the chest is generated.
Is that intentional? Would it be possible to fire the event after the chest is generated?
I suggest that you run a task after catching the generation that will then mess with the contents of the chest, using BukkitScheduler.
That would be a possible solution, yes. Though I still think it is weird how event.getChest()
does not return the chest.
Yeah, it is weird.