mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Use str_starts_with and str_contains instead of strpos (#5482)
This commit is contained in:
@ -70,7 +70,7 @@ use function explode;
|
||||
use function max;
|
||||
use function microtime;
|
||||
use function mt_rand;
|
||||
use function strpos;
|
||||
use function str_starts_with;
|
||||
use function strtolower;
|
||||
|
||||
class ParticleCommand extends VanillaCommand{
|
||||
@ -208,17 +208,17 @@ class ParticleCommand extends VanillaCommand{
|
||||
return new EntityFlameParticle();
|
||||
}
|
||||
|
||||
if(strpos($name, "iconcrack_") === 0){
|
||||
if(str_starts_with($name, "iconcrack_")){
|
||||
$d = explode("_", $name);
|
||||
if(count($d) === 3){
|
||||
return new ItemBreakParticle(ItemFactory::getInstance()->get((int) $d[1], (int) $d[2]));
|
||||
}
|
||||
}elseif(strpos($name, "blockcrack_") === 0){
|
||||
}elseif(str_starts_with($name, "blockcrack_")){
|
||||
$d = explode("_", $name);
|
||||
if(count($d) === 2){
|
||||
return new TerrainParticle(BlockFactory::getInstance()->get(((int) $d[1]) & 0xff, ((int) $d[1]) >> 12));
|
||||
}
|
||||
}elseif(strpos($name, "blockdust_") === 0){
|
||||
}elseif(str_starts_with($name, "blockdust_")){
|
||||
$d = explode("_", $name);
|
||||
if(count($d) >= 4){
|
||||
return new DustParticle(new Color(((int) $d[1]) & 0xff, ((int) $d[2]) & 0xff, ((int) $d[3]) & 0xff, isset($d[4]) ? ((int) $d[4]) & 0xff : 255));
|
||||
|
Reference in New Issue
Block a user