项目作者: Pequla

项目描述 :
Very simple and fast Minecraft server status library using the Server List Ping protocol
高级语言: Java
项目地址: git://github.com/Pequla/ServerPing.git
创建时间: 2021-04-18T13:41:48Z
项目社区:https://github.com/Pequla/ServerPing

开源协议:MIT License

下载


ServerPing

Are you looking for a simple-to-use Minecraft Server List Ping library with a permissive licence? Look no further, you
just found it.

Usage

If you are using Maven just add the following to your pom.xml

  1. <repositories>
  2. <repository>
  3. <id>pequla-repo</id>
  4. <url>https://maven.pequla.com/releases</url>
  5. </repository>
  6. </repositories>
  7. <dependencies>
  8. <dependency>
  9. <groupId>com.pequla</groupId>
  10. <artifactId>server-ping</artifactId>
  11. <version>1.2</version>
  12. </dependency>
  13. <dependency>
  14. <groupId>com.google.code.gson</groupId>
  15. <artifactId>gson</artifactId>
  16. <version>2.10.1</version>
  17. </dependency>
  18. </dependencies>

Example

  1. public class ServerPingExample {
  2. public static void main(String[] args) throws IOException {
  3. InetAddress address = InetAddress.getByName("play.beocraft.net");
  4. int port = 25565;
  5. ServerPing ping = new ServerPing(new InetSocketAddress(address, port));
  6. StatusResponse response = ping.fetchData();
  7. System.out.println(response.getPlayers().getOnline());
  8. }
  9. }