Skip to content

Commit

Permalink
Fix @Morphan1's breaking of inventory.contains
Browse files Browse the repository at this point in the history
Also make list.matches always return true to avoid similar mistakes in
the future.
  • Loading branch information
mcmonkey4eva committed Nov 18, 2014
1 parent 8d5810d commit 3e47b8c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/main/java/net/aufdemrand/denizen/objects/dInventory.java
Expand Up @@ -1300,7 +1300,7 @@ public String getAttribute(Attribute attribute) {
// Returns whether the inventory contains any of the specified items.
// -->
if (attribute.startsWith("contains_any")) {
if (attribute.hasContext(1) && dList.matches(attribute.getContext(1))) {
if (attribute.hasContext(1)) {
int qty = 1;
int attribs = 1;

Expand Down Expand Up @@ -1331,7 +1331,7 @@ public String getAttribute(Attribute attribute) {
// Returns whether the inventory contains all of the specified items.
// -->
if (attribute.startsWith("contains")) {
if (attribute.hasContext(1) && dList.matches(attribute.getContext(1))) {
if (attribute.hasContext(1)) {
int qty = 1;
int attribs = 1;

Expand Down
19 changes: 1 addition & 18 deletions src/main/java/net/aufdemrand/denizen/objects/dList.java
Expand Up @@ -76,24 +76,7 @@ else if (string.indexOf('@') == 2) {


public static boolean matches(String arg) {

boolean flag = false;

if (arg.startsWith("fl")) {
if (arg.indexOf('[') == 2) {
int cb = arg.indexOf(']');
if (cb > 4 && arg.indexOf('@') == (cb + 1)) {
String owner = arg.substring(3, cb);
flag = arg.substring(cb + 2).length() > 0 && (dPlayer.matches(owner)
|| (Depends.citizens != null && dNPC.matches(owner)));
}
}
else if (arg.indexOf('@') == 2) {
flag = arg.substring(3).length() > 0;
}
}

return flag || arg.contains("|") || arg.contains(internal_escape) || arg.startsWith("li@");
return true;
}


Expand Down

0 comments on commit 3e47b8c

Please sign in to comment.