mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 05:15:13 +00:00
Avoid repeated strtolower usages in a couple of places
This commit is contained in:
parent
d6bbf8217d
commit
0c7f8470b9
@ -272,10 +272,11 @@ class SimpleCommandMap implements CommandMap{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//These registered commands have absolute priority
|
//These registered commands have absolute priority
|
||||||
|
$lowerAlias = strtolower($alias);
|
||||||
if(count($targets) > 0){
|
if(count($targets) > 0){
|
||||||
$this->knownCommands[strtolower($alias)] = new FormattedCommandAlias(strtolower($alias), $targets);
|
$this->knownCommands[$lowerAlias] = new FormattedCommandAlias($lowerAlias, $targets);
|
||||||
}else{
|
}else{
|
||||||
unset($this->knownCommands[strtolower($alias)]);
|
unset($this->knownCommands[$lowerAlias]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -108,8 +108,9 @@ final class LegacyStringToItemParser{
|
|||||||
throw new LegacyStringToItemParserException("Unable to parse \"" . $b[1] . "\" from \"" . $input . "\" as a valid meta value");
|
throw new LegacyStringToItemParserException("Unable to parse \"" . $b[1] . "\" from \"" . $input . "\" as a valid meta value");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($this->map[strtolower($b[0])])){
|
$id = strtolower($b[0]);
|
||||||
$item = $this->itemFactory->get($this->map[strtolower($b[0])], $meta);
|
if(isset($this->map[$id])){
|
||||||
|
$item = $this->itemFactory->get($this->map[$id], $meta);
|
||||||
}else{
|
}else{
|
||||||
throw new LegacyStringToItemParserException("Unable to resolve \"" . $input . "\" to a valid item");
|
throw new LegacyStringToItemParserException("Unable to resolve \"" . $input . "\" to a valid item");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user