Open EphisPaF opened 7 years ago
First of all: Thank you for providing all the info and even finding the debug option! This is how bug reports should go :)
I will have a look at the bug soon. Where you selecting the data automatically or actually refreshing every 10 seconds?
Did you modify any of my PHP code? or just the html/css?
I do a manual refresh with [F5] key. I did modify your php code juste a little bit, here are the changes :
in SIPRequester.class.php rename as SIPRequester.php :
/**
* Holds the returned values
*
* @var array
*/
public $returnedMap = [];
public function __construct() {
//$this->server = $server;
$this->server = '127.0.0.1';
//$this->port = $port;
$this->port = 25566;
}
adding some display in SIPRequester.doRequest() :
$result = socket_connect($socket, $this->server, $this->port);
echo 'socket result : '.$result;
And that's all the code I stole from you :p
I call the class like this in my page :
<?php
include_once 'functions/SIPRequester.php';
$requester = new SIPRequester();
$requester->addValueToRequest('time');
//$requester->addValueToRequest('weather');
//$requester->addValueToRequest('uptime');
//$requester->addValueToRequest('daynight');
//$requester->addValueToRequest('players', 'latestdeath');
//$requester->addValueToRequest('players', 'lastonline');
//$requester->addValueToRequest('deaths');
//$requester->addValueToRequest('tps');
//$requester->addValueToRequest('versions');
$requester->doRequest();
$players = $requester->getValue('players');
$deaths = $requester->getValue('deaths');
I write the result like you did on your example :
<div>
<div><div class="toprow"><span>Heure</span><span><?= $requester->getValue('time')[0] ?></span></div></div>
<div><div class="toprow"><span>Jour/nuit</span><span><?= $requester->getValue('daynight') == TRUE ? 'Jour' : 'Nuit' ?></span></div></div>
<div><div class="toprow"><span>Météo</span><span><?= getWeather($requester) ?></span></div></div>
<div><div class="toprow"><span>Uptime</span><span><?= date("H:i:s", floor($requester->getValue('uptime') / 1000)) ?></span></div></div>
<div><div class="toprow"><span>TPS (overworld)</span><span><?= $requester->getValue('tps')['0']['tps'] ?>/20</span></div></div>
<div><div class="toprow"><span>TPS (nether)</span><span><?= $requester->getValue('tps')['-1']['tps'] ?>/20</span></div></div>
<div><div class="toprow"><span>TPS (end)</span><span><?= $requester->getValue('tps')['1']['tps'] ?>/20</span></div></div>
</div>
...
<?php
foreach ($players as $player=>$death)
{
echo "<tr><td>" . $player . "</td>";
echo "<td>" . $deaths['LEADERBOARD'][$player] ?? '0' . "</td>";
echo "<td>" . $death . "</td></tr>";
}
?>
<pre>
<?php print_r($requester->returnedMap); ?>
</pre>
But since the problem seems to be server side, I don't think there could be any clue on the web side. I hope this will help you solving the issue. Btw, you did a great job, I was looking to add data like, last time online or latestDeath, then I found your mod, that was so helpful ! You really enhance the minecraft query which is really poor data serving ... :'(
Hi,
I'm using the 3.0.33 version on my minecraft 1.12 server with forge. I'm working on a web site that provide server's info, but SIP didn't return data all the time. I reduce the amount of data send to only time but it still don't return all the time. Should I use an other build version ?
Infos about the server configuration : OS : Debian 9 JAVA : openjdk version "1.8.0_141" MC : 1.12 Forge : forge-1.12-14.21.1.2407-universal SIP : ServerInfoProvider-1.12-3.0.33-universal
You can get a view of the website here : http://brotopia.malus.me/ The source code from this website is inspired from this github : https://github.com/K-4U/SIP-web
Here is the display of 1 time working and 1 failure right after, with debug mode activated :