Use str_starts_with and str_contains instead of strpos (#5482)

This commit is contained in:
Alexey
2022-12-31 00:41:30 +03:00
committed by GitHub
parent 0d169b4e80
commit 0d31b25fba
6 changed files with 18 additions and 16 deletions

View File

@ -125,8 +125,8 @@ use function mb_strlen;
use function microtime;
use function preg_match;
use function sprintf;
use function str_starts_with;
use function strlen;
use function strpos;
use function substr;
use function trim;
use const JSON_THROW_ON_ERROR;
@ -726,7 +726,7 @@ class InGamePacketHandler extends PacketHandler{
}
public function handleCommandRequest(CommandRequestPacket $packet) : bool{
if(strpos($packet->command, '/') === 0){
if(str_starts_with($packet->command, '/')){
$this->player->chat($packet->command);
return true;
}