<commit_before><?php
namespace robske_110\SL;

use pocketmine\scheduler\PluginTask;
use pocketmine\utils\TextFormat as TF;

class StatusListManager{
	/** @var StatusList */
	private $plugin;
	/** @var array */
	private $listServers = []; //[(string) hostname, (int) port, ?bool online]
	/** @var int */
	private $dataRefreshTick = -1;
	
	public function __construct(StatusList $plugin){
		$this->plugin = $plugin;
	}
	
	public function addStatusServer(string $hostname, int $port): bool{
		if(!isset($this->listServers[$hostname."@".$port])){
			$this->listServers[$hostname."@".$port] = [$hostname, $port, null];
			return true;
		}else{
			return false;
		}
	}
	
	public function remStatusServer(string $hostname, int $port): bool{
		if(isset($this->listServers[$hostname."@".$port])){
			unset($this->listServers[$hostname."@".$port]);
			return true;
		}else{
			return false;
		}
	}
	
	public function getStatusServers(): array{
		if(!$this->update()){
			$this->plugin->getLogger()->critical("Unexpected error: Trying to get SignServerStats plugin instance failed!");
			$this->plugin->getServer()->getPluginManager()->disablePlugin($this->plugin);
		}
		return $this->listServers;
	}
	
	public function getStatusServerRefreshTick(): int{
		return $this->dataRefreshTick;
	}
	
	public function update(): bool{
		if(($sss = $this->plugin->getSSS()) === null){
			return false;
		}
		if(($lastRefreshTick = $sss->getLastRefreshTick()) > $this->dataRefreshTick){
			return true;
		}
		$serverOnlineArray = $sss->getServerOnline();
		foreach($this->listServers as $index => $listServer){
			if(isset($serverOnlineArray[$index])){
		    	$this->listServers[$index][2] = $serverOnlineArray[$index];
			}else{
				$this->listServers[$index][2] = null;
			}
		}
		$this->dataRefreshTick = $lastRefreshTick;
		return true;
	}
}<commit_msg>I defiantly wanted to only update if the data is too new (NOT)<commit_after><?php
namespace robske_110\SL;

use pocketmine\scheduler\PluginTask;
use pocketmine\utils\TextFormat as TF;

class StatusListManager{
	/** @var StatusList */
	private $plugin;
	/** @var array */
	private $listServers = []; //[(string) hostname, (int) port, ?bool online]
	/** @var int */
	private $dataRefreshTick = -1;
	
	public function __construct(StatusList $plugin){
		$this->plugin = $plugin;
	}
	
	public function addStatusServer(string $hostname, int $port): bool{
		if(!isset($this->listServers[$hostname."@".$port])){
			$this->listServers[$hostname."@".$port] = [$hostname, $port, null];
			return true;
		}else{
			return false;
		}
	}
	
	public function remStatusServer(string $hostname, int $port): bool{
		if(isset($this->listServers[$hostname."@".$port])){
			unset($this->listServers[$hostname."@".$port]);
			return true;
		}else{
			return false;
		}
	}
	
	public function getStatusServers(): array{
		if(!$this->update()){
			$this->plugin->getLogger()->critical("Unexpected error: Trying to get SignServerStats plugin instance failed!");
			$this->plugin->getServer()->getPluginManager()->disablePlugin($this->plugin);
		}
		return $this->listServers;
	}
	
	public function getStatusServerRefreshTick(): int{
		return $this->dataRefreshTick;
	}
	
	public function update(): bool{
		if(($sss = $this->plugin->getSSS()) === null){
			return false;
		}
		if(($lastRefreshTick = $sss->getLastRefreshTick()) < $this->dataRefreshTick){
			return true;
		}
		$serverOnlineArray = $sss->getServerOnline();
		foreach($this->listServers as $index => $listServer){
			if(isset($serverOnlineArray[$index])){
		    	$this->listServers[$index][2] = $serverOnlineArray[$index];
			}else{
				$this->listServers[$index][2] = null;
			}
		}
		$this->dataRefreshTick = $lastRefreshTick;
		return true;
	}
}
{'fraction_non_alphanumeric': 0.17737167428110723, 'fraction_numerical': 0.0032249395323837677, 'mean_word_length': 4.665144596651446, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 56, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1887562', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1222, 'n_words': 252}