Implement DMobDeathEvent

This commit is contained in:
Daniel Saukel 2016-01-12 22:53:33 +01:00
parent 6ec3808a25
commit 80ebdeeda3

View File

@ -1,6 +1,7 @@
package io.github.dre2n.dungeonsxl.mob;
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
import io.github.dre2n.dungeonsxl.event.dmob.DMobDeathEvent;
import io.github.dre2n.dungeonsxl.trigger.MobTrigger;
import java.util.Random;
@ -64,6 +65,12 @@ public class DMob {
for (DMob dMob : gameWorld.getDMobs()) {
if (dMob.entity == victim) {
DMobDeathEvent dMobDeathEvent = new DMobDeathEvent(dMob, event);
if (dMobDeathEvent.isCancelled()) {
return;
}
if (dMob.type != null) {
for (ItemStack itemStack : dMob.type.getDrops().keySet()) {
Random randomGenerator = new Random();