Skip to content

Commit

Permalink
Fixed event not firing when "by <>" missing and "in area" used
Browse files Browse the repository at this point in the history
  • Loading branch information
Talamar1 committed Jul 9, 2015
1 parent 5569829 commit f51e817
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -33,10 +33,8 @@ public class EntityDamagedScriptEvent extends BukkitScriptEvent implements Liste

// <--[event]
// @Events
// entity damaged (in <area>) (with:<item>)
// entity damaged by <cause> (in <area>) (with:<item>)
// <entity> damaged (in <area>) (with:<item>)
// <entity> damaged by <cause> (in <area>) (with:<item>)
// entity damaged (by <cause>) (in <area>) (with:<item>)
// <entity> damaged (by <cause>) (in <area>) (with:<item>)
// entity damages entity (in <area>) (with:<item>)
// entity damages <entity> (in <area>) (with:<item>)
// entity damaged by entity (in <area>) (with:<item>)
Expand Down Expand Up @@ -90,8 +88,10 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptContainer scriptContainer, String s) {
String lower = CoreUtilities.toLowerCase(s);
String cmd = CoreUtilities.getXthArg(1, lower);
String attacker = cmd.equals("damages") ? CoreUtilities.getXthArg(0, lower) : CoreUtilities.getXthArg(3, lower);
String attacker = cmd.equals("damages") ? CoreUtilities.getXthArg(0, lower) :
CoreUtilities.getXthArg(2, lower).equals("by") ? CoreUtilities.getXthArg(3, lower) : "";
String target = cmd.equals("damages") ? CoreUtilities.getXthArg(2, lower) : CoreUtilities.getXthArg(0, lower);

if (attacker.length() > 0) {
if (damager != null) {
boolean projectileMatched = false;
Expand Down

0 comments on commit f51e817

Please sign in to comment.