承接 jasonw4331/libpmquery 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jasonw4331/libpmquery

最新稳定版本:1.0.0

Composer 安装命令:

composer require jasonw4331/libpmquery

包简介

A library for querying Minecraft Bedrock servers

README 文档

README

Poggit-Ci

A PocketMine Virion which allows plugins to query other servers for a selection of information

Basic Usage

This virion was made for developers to query Pocketmine-MP servers with ease. Here is some basic functionality:

Required imports

The following imports are necessary to use the virion library:

use jasonw4331\libpmquery\PMQuery;
use jasonw4331\libpmquery\PmQueryException;

API

The querying API is a single function which grabs the data from whatever server you input. Usage is as follows:

$query = PMQuery::query("my.server.net", 19132);

The values returned will follow these values/types:

$query['GameName'];         // Returns the server software being used
$query['HostName'];         // Returns the server host name
$query['Protocol'];         // Returns the protocol version allowed to connect
$query['Version'];          // Returns the client version allowed to connect
$query['Players'];          // Returns the number of players on the server currently
$query['MaxPlayers'];       // Returns the maximum player count of the server
$query['ServerId'];         // Returns the raknet server id
$query['Map'];              // Returns the default world name
$query['GameMode'];         // Returns the default gamemode
$query['NintendoLimited'];  // Returns the status of Nintendo's limitation to join
$query['IPv4Port'];         // Returns the ipv4 port number
$query['IPv6Port'];         // Returns the ipv6 port number
$query['Extra'];            // I still don't know what this info is

Offline Queries

Queries sent to offline servers always throw a PmQueryException. Exceptions can be caught in a try/catch statement to log their offline status.

try{
    $query = PMQuery::query("my.server.net", 19133);
    $players = (int) $query['Players'];
    Server::getInstance()->getLogger()->info("There are ".$players." on the queried server right now!");
}catch(PmQueryException $e){
    //you can choose to log this if you want
    Server::getInstance()->getLogger()->info("The queried server is offline right now!");
}

统计信息

  • 总下载量: 144
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 41
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 41
  • Watchers: 2
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: lgpl-3.0-or-later
  • 更新时间: 2023-04-22