allow exact matches for block search

This commit is contained in:
David Vierra 2010-09-19 15:18:01 -10:00
parent aae47fe2d9
commit 8d6cc52f06

8
mce.py
View File

@ -57,17 +57,22 @@ class mce(object):
"replace", "replace",
"export", "export",
"import", "import",
"player", "player",
"spawn", "spawn",
"createchunks", "createchunks",
"deletechunks", "deletechunks",
"prune", "prune",
"relight", "relight",
"save", "save",
"load", "load",
"reload", "reload",
"quit", "quit",
"exit", "exit",
"help", "help",
"blocks", "blocks",
"debug", "debug",
@ -100,6 +105,9 @@ class mce(object):
keyword = command.pop(0) keyword = command.pop(0)
def blocksMatching(search): def blocksMatching(search):
if search in self.level.materials.names:
#exact match
return [search]
return filter(lambda x:search.lower() in x.lower(), self.level.materials.names) return filter(lambda x:search.lower() in x.lower(), self.level.materials.names)
matches = blocksMatching(keyword) matches = blocksMatching(keyword)