first commit

This commit is contained in:
小喵 2022-07-11 18:09:15 +08:00 committed by Ming Tsay
commit db313f5eef
Signed by: mt
GPG key ID: 2BCF198BD3341FB3
47 changed files with 2006 additions and 0 deletions

25
app/Minecraft.php Normal file
View file

@ -0,0 +1,25 @@
<?php
namespace MingTsay\Akanyan;
use xPaw\MinecraftPing;
use xPaw\MinecraftPingException;
class Minecraft
{
public static function query(): ?array
{
$host = $_ENV['MINECRAFT_QUERY_HOST'];
$port = (int)$_ENV['MINECRAFT_QUERY_PORT'];
$query = new MinecraftPing($host, $port);
try {
$result = $query->Query();
} catch (MinecraftPingException) {
$result = null;
} finally {
$query->Close();
}
return $result ?: null;
}
}