mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Cleaned up bool comparison mess
This commit is contained in:
@ -168,7 +168,7 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
default:
|
||||
$value = [];
|
||||
}
|
||||
if($types === true){
|
||||
if($types){
|
||||
$data[$key] = [$type, $value];
|
||||
}else{
|
||||
$data[$key] = $value;
|
||||
|
@ -236,7 +236,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
|
||||
$pk = $packet->__encapsulatedPacket;
|
||||
}
|
||||
|
||||
$this->interface->sendEncapsulated($identifier, $pk, ($needACK === true ? RakLib::FLAG_NEED_ACK : 0) | ($immediate === true ? RakLib::PRIORITY_IMMEDIATE : RakLib::PRIORITY_NORMAL));
|
||||
$this->interface->sendEncapsulated($identifier, $pk, ($needACK ? RakLib::FLAG_NEED_ACK : 0) | ($immediate ? RakLib::PRIORITY_IMMEDIATE : RakLib::PRIORITY_NORMAL));
|
||||
return $pk->identifierACK;
|
||||
}else{
|
||||
$this->server->batchPackets([$player], [$packet], true, $immediate);
|
||||
|
@ -84,7 +84,7 @@ class RCON{
|
||||
|
||||
public function check(){
|
||||
for($n = 0; $n < $this->threads; ++$n){
|
||||
if($this->workers[$n]->isTerminated() === true){
|
||||
if($this->workers[$n]->isTerminated()){
|
||||
$this->workers[$n] = new RCONInstance($this->socket, $this->password, $this->clientsPerThread);
|
||||
}elseif($this->workers[$n]->isWaiting()){
|
||||
if($this->workers[$n]->response !== ""){
|
||||
|
@ -37,7 +37,7 @@ class RCONInstance extends Thread{
|
||||
private $waiting;
|
||||
|
||||
public function isWaiting(){
|
||||
return $this->waiting === true;
|
||||
return $this->waiting;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,7 +72,7 @@ class RCONInstance extends Thread{
|
||||
private function readPacket($client, &$size, &$requestID, &$packetType, &$payload){
|
||||
socket_set_nonblock($client);
|
||||
$d = socket_read($client, 4);
|
||||
if($this->stop === true){
|
||||
if($this->stop){
|
||||
return false;
|
||||
}elseif($d === false){
|
||||
return null;
|
||||
@ -96,7 +96,7 @@ class RCONInstance extends Thread{
|
||||
|
||||
public function run(){
|
||||
$this->registerClassLoader();
|
||||
while($this->stop !== true){
|
||||
while(!$this->stop){
|
||||
$this->synchronized(function(){
|
||||
$this->wait(2000);
|
||||
});
|
||||
@ -117,7 +117,7 @@ class RCONInstance extends Thread{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($done === false){
|
||||
if(!$done){
|
||||
@socket_close($client);
|
||||
}
|
||||
}
|
||||
@ -126,7 +126,7 @@ class RCONInstance extends Thread{
|
||||
for($n = 0; $n < $this->maxClients; ++$n){
|
||||
$client = &$this->{"client" . $n};
|
||||
if($client !== null){
|
||||
if($this->{"status" . $n} !== -1 and $this->stop !== true){
|
||||
if($this->{"status" . $n} !== -1 and !$this->stop){
|
||||
if($this->{"status" . $n} === 0 and $this->{"timeout" . $n} < microtime(true)){ //Timeout
|
||||
$this->{"status" . $n} = -1;
|
||||
continue;
|
||||
|
@ -31,7 +31,7 @@ use pocketmine\utils\Utils;
|
||||
abstract class UPnP{
|
||||
|
||||
public static function PortForward(int $port) : bool{
|
||||
if(Utils::$online === false){
|
||||
if(!Utils::$online){
|
||||
return false;
|
||||
}
|
||||
if(Utils::getOS() != "win" or !class_exists("COM")){
|
||||
@ -56,7 +56,7 @@ abstract class UPnP{
|
||||
}
|
||||
|
||||
public static function RemovePortForward(int $port) : bool{
|
||||
if(Utils::$online === false){
|
||||
if(!Utils::$online){
|
||||
return false;
|
||||
}
|
||||
if(Utils::getOS() != "win" or !class_exists("COM")){
|
||||
|
Reference in New Issue
Block a user