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