Fixing misused brezk statements

pull/5/merge
Ad5001 5 years ago
parent e3ea4cfeb5
commit 0cb3975928
  1. 6
      src/Ad5001/PlayerSelectors/selector/AllPlayers.php
  2. 6
      src/Ad5001/PlayerSelectors/selector/Entities.php
  3. 4
      src/Ad5001/PlayerSelectors/selector/RandomPlayer.php
  4. 6
      src/Ad5001/PlayerSelectors/selector/WorldPlayers.php

@ -34,9 +34,9 @@ class AllPlayers extends Selector{
$params = $parameters + $defaultParams;
$return = [];
foreach(Server::getInstance()->getOnlinePlayers() as $p){
if($params["c"] !== 0 && count($return) == $params["c"]) break; // Too much players
if($p->getLevel()->getName() !== $params["lvl"] && $params["lvl"] !== "") break; // Not in the right level
if(!$this->checkDefaultParams($p, $params)) break;
if($params["c"] !== 0 && count($return) == $params["c"]) continue; // Too much players
if($p->getLevel()->getName() !== $params["lvl"] && $params["lvl"] !== "") continue; // Not in the right level
if(!$this->checkDefaultParams($p, $params)) continue;
$return[] = $p->getName();
}
return $return;

@ -37,9 +37,9 @@ class Entities extends Selector{
$return = [];
foreach(Server::getInstance()->getLevels() as $lvl){
foreach($lvl->getEntities() as $e){
if($params["c"] !== 0 && count($return) == $params["c"]) break; // Too much players
if($e->getLevel()->getName() !== $params["lvl"] && $params["lvl"] !== "") break; // Not in the right level
if(!$this->checkDefaultParams($e, $params)) break;
if($params["c"] !== 0 && count($return) == $params["c"]) continue; // Too much players
if($e->getLevel()->getName() !== $params["lvl"] && $params["lvl"] !== "") continue; // Not in the right level
if(!$this->checkDefaultParams($e, $params)) continue;
$return[] = "e" . $e->getId();
}
}

@ -34,8 +34,8 @@ class RandomPlayer extends Selector{
$params = $parameters + $defaultParams;
$possible = [];
foreach(Server::getInstance()->getOnlinePlayers() as $p){
if($p->getLevel()->getName() !== $params["lvl"] && $params["lvl"] !== "") break; // Not in the right level
if(!$this->checkDefaultParams($p, $params)) break;
if($p->getLevel()->getName() !== $params["lvl"] && $params["lvl"] !== "") continue; // Not in the right level
if(!$this->checkDefaultParams($p, $params)) continue;
$possible[] = $p;
}
if(count($possible) == 0) return [];

@ -38,9 +38,9 @@ class WorldPlayers extends Selector{
$params = $parameters + $defaultParams;
$return = [];
foreach(Server::getInstance()->getOnlinePlayers() as $p){
if($params["c"] !== 0 && count($return) == $params["c"]) break; // Too much players
if($p->getLevel()->getName() !== $params["lvl"] && $params["lvl"] !== "") break; // Not in the right level
if(!$this->checkDefaultParams($p, $params)) break;
if($params["c"] !== 0 && count($return) == $params["c"]) continue; // Too much players
if($p->getLevel()->getName() !== $params["lvl"] && $params["lvl"] !== "") continue; // Not in the right level
if(!$this->checkDefaultParams($p, $params)) continue;
$return[] = $p->getName();
}
return $return;

Loading…
Cancel
Save