DiabloDrops

DiabloDrops

41.7k Downloads

Probable bug with RuinGenerateEvent

TfT-02 opened this issue ยท 6 comments

commented

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/

commented

After doing more tests, I noticed that the coordinates are actually correct.
Does this event get called before the chest gets generated?

commented

It does get called before the chest is generated.

commented

Is that intentional? Would it be possible to fire the event after the chest is generated?

commented

Yeah, it is weird.

commented

I suggest that you run a task after catching the generation that will then mess with the contents of the chest, using BukkitScheduler.

commented

That would be a possible solution, yes. Though I still think it is weird how event.getChest() does not return the chest.