mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
static analysis
This commit is contained in:
parent
23866359c9
commit
4d874e7e78
@ -125,7 +125,7 @@ class FormattedCommandAlias extends Command{
|
||||
|
||||
$replacement = "";
|
||||
if($rest and $position < count($args)){
|
||||
for($i = $position; $i < count($args); ++$i){
|
||||
for($i = $position, $c = count($args); $i < $c; ++$i){
|
||||
if($i !== $position){
|
||||
$replacement .= " ";
|
||||
}
|
||||
|
@ -76,6 +76,8 @@ class Attribute{
|
||||
* @param bool $shouldSend
|
||||
*
|
||||
* @return Attribute
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function addAttribute($id, $name, $minValue, $maxValue, $defaultValue, $shouldSend = true){
|
||||
if($minValue > $maxValue or $defaultValue > $maxValue or $defaultValue < $minValue){
|
||||
|
@ -37,7 +37,7 @@ class BaseLang{
|
||||
}
|
||||
|
||||
if(is_dir($path)){
|
||||
$allFiles = scandir($path);
|
||||
$allFiles = scandir($path, SCANDIR_SORT_NONE);
|
||||
|
||||
if($allFiles !== false){
|
||||
$files = array_filter($allFiles, function($filename){
|
||||
|
@ -223,7 +223,7 @@ class McRegion extends BaseLevelProvider{
|
||||
$isValid = (file_exists($path . "/level.dat") and is_dir($path . "/region/"));
|
||||
|
||||
if($isValid){
|
||||
$files = array_filter(scandir($path . "/region/"), function($file){
|
||||
$files = array_filter(scandir($path . "/region/", SCANDIR_SORT_NONE), function($file){
|
||||
return substr($file, strrpos($file, ".") + 1, 2) === "mc"; //region file
|
||||
});
|
||||
|
||||
|
@ -64,7 +64,7 @@ class ResourcePackManager{
|
||||
}
|
||||
|
||||
if(!file_exists($this->path . "resource_packs.yml")){
|
||||
file_put_contents($this->path . "resource_packs.yml", file_get_contents($this->server->getFilePath() . "src/pocketmine/resources/resource_packs.yml"));
|
||||
copy($this->server->getFilePath() . "src/pocketmine/resources/resource_packs.yml", $this->path . "resource_packs.yml");
|
||||
}
|
||||
|
||||
$this->resourcePacksConfig = new Config($this->path . "resource_packs.yml", Config::YAML, []);
|
||||
|
@ -305,7 +305,6 @@ class Utils{
|
||||
break;
|
||||
case "bsd":
|
||||
case "mac":
|
||||
$processors = (int) `sysctl -n hw.ncpu`;
|
||||
$processors = (int) `sysctl -n hw.ncpu`;
|
||||
break;
|
||||
case "win":
|
||||
@ -477,7 +476,7 @@ class Utils{
|
||||
|
||||
public static function javaStringHash($string){
|
||||
$hash = 0;
|
||||
for($i = 0; $i < strlen($string); $i++){
|
||||
for($i = 0, $len = strlen($string); $i < $len; $i++){
|
||||
$ord = ord($string{$i});
|
||||
if($ord & 0x80){
|
||||
$ord -= 0x100;
|
||||
|
Loading…
x
Reference in New Issue
Block a user