Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tltneon committed Aug 2, 2024
1 parent 87bdcb5 commit 3e1e1de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/lgsl_protocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,17 @@ abstract function process();
public function execute(): int {
$time = microtime(true);
$status = $this->process();
if ($status === $this::SUCCESS && $this->separatedPackets) {
if ($status === $this::SUCCESS) {
if ($this->separatedPackets) {
if ($this->_need['e']) $status |= $this->process();
if ($this->_need['p']) $status |= $this->process();
} else {
$this->_need = [
's' => false,
'e' => false,
'p' => false
];
}
}
$this->_data['o']['time_execution'] = $time - microtime(true);
if ($status !== $this::NO_RESPOND) {
Expand Down
3 changes: 2 additions & 1 deletion tests/mockedServersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function readRaw($length = 4096) {
function example($type) {
$list = [
Protocol::MINECRAFTPE => "[null][null][null][null][null]6��[null]c�wV4�[null]��[null]��������4Vx[null]^MCPE;§r§eLGSLSERVERNAME;649;1.20.60;34;500;63020977098711111;Bedrock Edition;Survival;1;19132;19132;",
Protocol::UNVANQUISHED => "....statusResponse\n\gamename\base\mapname\utcs\protocol\86\sv_hostname\^1LGSLSERVERNAME\sv_maxRate\\0\sv_maxclients\\64\\timelimit\\60\\version\Unvanquished\n140 0 \"^9[bot]^iDengos\"\n89 0 \"^9[bot]^dEjim\"",
];
return $list[$type];
}
Expand All @@ -23,7 +24,7 @@ class LGSLMockedTest extends TestCase {
public function testMockedServers() {
echo("\nTesting mocked servers");
ob_flush();
foreach ([Protocol::MINECRAFTPE] as $type) {
foreach ([Protocol::MINECRAFTPE, Protocol::UNVANQUISHED] as $type) {
$server = new Server(["ip" => "LgslServerIp.com", "c_port" => 25565, "q_port" => 25565, "type" => $type]);
$protocol = new Protocol($server, null);
$query = "tltneon\LGSL\\" . $protocol->lgslProtocolClass($server->getType());
Expand Down

0 comments on commit 3e1e1de

Please sign in to comment.