first commit
This commit is contained in:
commit
db313f5eef
47 changed files with 2006 additions and 0 deletions
25
app/Minecraft.php
Normal file
25
app/Minecraft.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue