Unnecessary arguments in the if expression

This commit is contained in:
Sunch 2024-08-17 19:58:16 +08:00
parent f9f4e65571
commit 4630481d54
9 changed files with 13 additions and 13 deletions

View file

@ -130,7 +130,7 @@ class AchievementAPI{
return false;
}
if(!isset($player->achievements[$achievementId]) or $player->achievements[$achievementId] == false){
if(!isset($player->achievements[$achievementId]) or !$player->achievements[$achievementId]){
return false;
}
return true;
@ -140,7 +140,7 @@ class AchievementAPI{
if(isset(self::$achievements[$achievementId])){
$result = ServerAPI::request()->api->dhandle("achievement.broadcast", ["player" => $player, "achievementId" => $achievementId]);
if($result !== false and $result !== true){
if(ServerAPI::request()->api->getProperty("announce-player-achievements") == true){
if(ServerAPI::request()->api->getProperty("announce-player-achievements")){
ServerAPI::request()->api->chat->broadcast($player->username . " has just earned the achievement [" . self::$achievements[$achievementId]["name"] . "]");
}else{
$player->sendChat("You have just earned the achievement [" . self::$achievements[$achievementId]["name"] . "]");

View file

@ -152,7 +152,7 @@ class ServerAPI{
//define("MAX_CHUNK_RATE", 20 / $this->getProperty("max-chunks-per-second", 8)); //Default rate ~512 kB/s
MobSpawner::$spawnAnimals = $this->getProperty("spawn-animals");
MobSpawner::$spawnMobs = $this->getProperty("spawn-mobs");
if($this->getProperty("upnp-forwarding") == true){
if($this->getProperty("upnp-forwarding")){
console("[INFO] [UPnP] Trying to port forward...");
UPnP_PortForward($this->getProperty("server-port"));
}
@ -245,7 +245,7 @@ class ServerAPI{
public function setProperty($name, $value, $save = true){
$this->config->set($name, $value);
if($save == true){
if($save){
$this->writeProperties();
}
$this->loadProperties();

View file

@ -106,7 +106,7 @@ class PocketMinecraftServer{
if(self::$FORCE_20_TPS){
ConsoleAPI::warn("Forcing 20 tps. This may result in higher CPU usage!");
}
if($this->extraprops->get("discord-msg") == true){
if($this->extraprops->get("discord-msg")){
if($this->extraprops->get("discord-webhook-url") !== "none"){
console("[INFO] Discord Logger is enabled.");
}else{
@ -226,7 +226,7 @@ class PocketMinecraftServer{
}
public function send2Discord($msg){
if($this->extraprops->get("discord-msg") == true and $this->extraprops->get("discord-webhook-url") !== "none"){
if($this->extraprops->get("discord-msg") and $this->extraprops->get("discord-webhook-url") !== "none"){
$url = $this->extraprops->get("discord-webhook-url");
$name = $this->extraprops->get("discord-bot-name");
$this->asyncOperation(ASYNC_CURL_POST, [

View file

@ -130,7 +130,7 @@ ini_set("opcache.mmap_base", bin2hex(Utils::getRandomBytes(8, false))); //Fix OP
define("SOURCE_SHA1SUM", bin2hex($sha1sum));
/***REM_START***/
if(!file_exists(DATA_PATH . "server.properties") and arg("no-wizard", false) != true){
if(!file_exists(DATA_PATH . "server.properties") and !arg("no-wizard", false)){
$installer = new Installer();
}
/***REM_END***/

View file

@ -15,7 +15,7 @@ class SetTimePacket extends RakNetDataPacket{
public function encode(){
$this->reset();
$this->putInt($this->time);
$this->putByte($this->started == true ? 0x80:0x00);
$this->putByte($this->started ? 0x80:0x00);
}
}

View file

@ -39,7 +39,7 @@ class QueryHandler{
public function regenerateInfo(){
$str = "";
$plist = "NostalgiaCore " . MAJOR_VERSION;
if($this->server->extraprops->get("query-plugins") == true){
if($this->server->extraprops->get("query-plugins")){
$pl = $this->server->api->plugin->getList();
if(count($pl) > 0){
$plist .= ":";

View file

@ -143,7 +143,7 @@ class RakNetParser{
$orderChannel = false;
}
if($hasSplit == true){
if($hasSplit){
$splitCount = $this->getInt();
$splitID = $this->getShort();
$splitIndex = $this->getInt();

View file

@ -4,7 +4,7 @@ class StopMessageThread extends Thread
{
private $page, $msg;
public function __construct(PocketMinecraftServer $server, $msg){
if($server->extraprops->get("discord-msg") == true and ($this->page = $server->extraprops->get("discord-webhook-url")) !== "none"){
if($server->extraprops->get("discord-msg") and ($this->page = $server->extraprops->get("discord-webhook-url")) !== "none"){
$this->msg = $server->extraprops->get("discord-ru-smiles") ? str_replace("@", " ", str_replace("Ы", "<:ru_cool:960113011383738369>", str_replace("Ь", "<:ru_cry:960112920346390548>", str_replace("Ъ", "<:ru_happy:960112868601237504>", $msg)))) : str_replace("@", "", $msg);
$this->name = $server->extraprops->get("discord-bot-name");
$this->start();

View file

@ -376,7 +376,7 @@ class Level{
if(count($this->players) == 0) return false;
if($this->server->api->time->getPhase($this) === "night"){ //TODO vanilla
foreach($this->players as $p){
if($p->isSleeping == false || $p->sleepingTime < 100){
if(!$p->isSleeping || $p->sleepingTime < 100){
return false;
}
}
@ -906,7 +906,7 @@ class Level{
return false;
}
$now = microtime(true);
if($this->stopTime == true){
if($this->stopTime){
$time = $this->startTime;
}else{
$time = $this->startTime + ($now - $this->startCheck) * 20;