Skip to content

Commit

Permalink
dMaterial.matches() returns true on any m@ prefixed string
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Nov 13, 2013
1 parent e57103b commit 44e4cb1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/net/aufdemrand/denizen/objects/dMaterial.java
Expand Up @@ -336,7 +336,12 @@ public static dMaterial valueOf(String string) {
*/
public static boolean matches(String arg) {

if (arg.toUpperCase().matches("(?:M@)?RANDOM"))
// Avoid case sensitivity
arg = arg.toUpperCase();

if (arg.startsWith("M@")) return true;

if (arg.matches("(?:M@)?RANDOM"))
return true;

Matcher m = materialPattern.matcher(arg);
Expand Down Expand Up @@ -640,7 +645,7 @@ else return new Element(material.name().equalsIgnoreCase(compared.getMaterial().
// by bukkit and should be used sparingly.
// -->
if (attribute.startsWith("data"))
return new Element(material.name())
return new Element(getData())
.getAttribute(attribute.fulfill(1));

return new Element(identify()).getAttribute(attribute.fulfill(0));
Expand Down

0 comments on commit 44e4cb1

Please sign in to comment.