Skip to content

Commit

Permalink
Added in new "with:" support and expanded "with" support
Browse files Browse the repository at this point in the history
  • Loading branch information
Talamar1 committed Jun 29, 2015
1 parent 579f78e commit 8e57cf5
Showing 1 changed file with 10 additions and 7 deletions.
Expand Up @@ -24,12 +24,10 @@ public class PlayerBreaksBlockScriptEvent extends BukkitScriptEvent implements L

// <--[event]
// @Events
// player breaks block (in <area>)
// player breaks <material> (in <area>)
// player breaks block with <item> (in <area>)
// player breaks <material> with <item> (in <area>)
// player breaks block with <material> (in <area>)
// player breaks <material> with <material> (in <area>)
// player breaks block (with:<item>) (in <area>)
// player breaks <material> (with:<item>) (in <area>)
// player breaks block (with:<material>) (in <area>)
// player breaks <material> (with:<material>) (in <area>)
//
// @Cancellable true
//
Expand Down Expand Up @@ -79,10 +77,15 @@ public boolean matches(ScriptContainer scriptContainer, String s) {
return false;
}

if (!runWithCheck(scriptContainer, s, lower, new dItem(event.getPlayer().getItemInHand()))) {
return false;
}
// Deprecated in favor of with: format
if (CoreUtilities.xthArgEquals(3, lower, "with")) {
String tool = CoreUtilities.getXthArg(4, lower);
dItem item = new dItem(event.getPlayer().getItemInHand());
if (!tool.equals(item.identifyNoIdentifier())) {
if (!tool.equals(item.identifyNoIdentifier()) && !tool.equals(item.identifySimpleNoIdentifier())
&& tool.equals(item.identifyMaterialNoIdentifier())) {
return false;
}
}
Expand Down

0 comments on commit 8e57cf5

Please sign in to comment.