Skip to content

Commit

Permalink
MythicMobs event fix
Browse files Browse the repository at this point in the history
This might fix DenizenScript#140
  • Loading branch information
Mwthorn committed May 15, 2018
1 parent 0981e6a commit 84544a8
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
// <context.drops> Returns a list of items dropped.
// <context.xp> Returns the xp dropped.
//
// @Determine
// Element(Number) to specify the new amount of XP to be dropped.
// dList(dItem) to specify new items to be dropped.
//
// @Plugin DepenizenBukkit, MythicMobs
//
// -->
Expand Down Expand Up @@ -115,11 +119,18 @@ public void destroy() {

@Override
public boolean applyDetermination(ScriptContainer container, String determination) {
if (aH.Argument.valueOf(determination).matchesArgumentList(dItem.class)) {
String lower = CoreUtilities.toLowerCase(determination);

if (aH.matchesInteger(lower)) {
experience = new Element(lower);
return true;
}
else if (aH.Argument.valueOf(determination).matchesArgumentList(dItem.class)) {
List<dItem> items = dList.valueOf(determination).filter(dItem.class);
for (dItem i : items) {
newDrops.add(i.getItemStack());
}
return true;
}
return super.applyDetermination(container, determination);
}
Expand Down Expand Up @@ -166,5 +177,6 @@ public void onMythicMobDeath(MythicMobDeathEvent event) {
if (!newDrops.isEmpty()) {
event.setDrops(newDrops);
}
event.setExp(experience.asInt());
}
}

0 comments on commit 84544a8

Please sign in to comment.