deathmarine / DiabloDrops

Bukkit plugin that adjusts the mob dropping mechanics to include regularly dropped enchanted items that could be commonly found in Diablo.
http://dev.bukkit.org/bukkit-plugins/diablodrops/
GNU General Public License v3.0
17 stars 19 forks source link

Probable bug with RuinGenerateEvent #86

Open TfT-02 opened 11 years ago

TfT-02 commented 11 years ago

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/

TfT-02 commented 11 years ago

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

ToppleTheNun commented 11 years ago

It does get called before the chest is generated.

TfT-02 commented 11 years ago

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

ToppleTheNun commented 11 years ago

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

TfT-02 commented 11 years ago

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

ToppleTheNun commented 11 years ago

Yeah, it is weird.