Skip to content

Commit

Permalink
implement new comparable options
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 11, 2015
1 parent 559ccaa commit d9a2b7d
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/main/java/net/aufdemrand/denizen/Denizen.java
Expand Up @@ -1454,6 +1454,50 @@ public boolean allowConsoleRedirection() {
public String cleanseLogString(String input) {
return LogInterceptor.cleanse(input);
}

@Override
public boolean matchesType(String comparable, String comparedto) {

boolean outcome = false;

if (comparedto.equalsIgnoreCase("location"))
outcome = dLocation.matches(comparable);

else if (comparedto.equalsIgnoreCase("material"))
outcome = dMaterial.matches(comparable);

else if (comparedto.equalsIgnoreCase("materiallist"))
outcome = dList.valueOf(comparable).containsObjectsFrom(dMaterial.class);

else if (comparedto.equalsIgnoreCase("entity"))
outcome = dEntity.matches(comparable);

else if (comparedto.equalsIgnoreCase("spawnedentity"))
outcome = (dEntity.matches(comparable) && dEntity.valueOf(comparable).isSpawned());

else if (comparedto.equalsIgnoreCase("npc"))
outcome = dNPC.matches(comparable);

else if (comparedto.equalsIgnoreCase("player"))
outcome = dPlayer.matches(comparable);

else if (comparedto.equalsIgnoreCase("offlineplayer"))
outcome = (dPlayer.valueOf(comparable) != null && !dPlayer.valueOf(comparable).isOnline());

else if (comparedto.equalsIgnoreCase("onlineplayer"))
outcome = (dPlayer.valueOf(comparable) != null && dPlayer.valueOf(comparable).isOnline());

else if (comparedto.equalsIgnoreCase("item"))
outcome = dItem.matches(comparable);

else if (comparedto.equalsIgnoreCase("cuboid"))
outcome = dCuboid.matches(comparable);

else
dB.echoError("Invalid 'matches' type '" + comparedto + "'!");

return outcome;
}
}


0 comments on commit d9a2b7d

Please sign in to comment.