ServerPingLib 1.1.4

Get MOTD information of MineCraft server with specified IP address directly

  1. TRCRedstoner
    Native Minecraft Version:
    Tested Minecraft Versions:
    • 1.7
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    • 1.15
    I can't speak English. I'm using translation software. If you don't understand what I want to say, I'm sorry.

    A brief introduction to the development of this API Library:

    In the process of writing this plug-in, I intended to make it a API library, but in the end I made it work on BungeeCord, Spigot, and Bukkit servers (which may not be practical, but I did).

    What does this API library do?

    This API library can fake a network protocol and read the MOTD information of the MineCraft server with the specified IP address without passing through the MineCraft client.

    List of functions of this API library:

    • Support for MC Servers in Versions 1.7.2 - 1.15.2 (or latest);
    • Support for reading two lines of MOTD information;
    • Support SRV domain name resolution;
    • Support for reading to basic information (online players, server version, server protocols and more);
    • Support for reading server Mods;
    • Support for reading server samples;
    • Support for reading server icons and saving them to local folders;
    • Colour fonts that retain read information;
    • Custom character encoding (default UTF-8)
    API Classes and Methods:

    studio.trc.minecraft.serverpinglib.API.MCServerSocket: Connection with server.
    public String getIP()
    public int getPort()
    public boolean isOnline()
    public boolean isSRVDomainName()
    public MCServerStatus getStatus()
    public MCServerStatus getStatus(ProtocolVersion version)
    public Socket getSocket()
    public void close()
    public static MCServerSocket getInstance(String ip, int port, int timeout)
    public static MCServerSocket getInstance(String ip, int port)

    studio.trc.minecraft.serverpinglib.API.MCServerStatus: Get information about this server
    public int getMaxPlayers()
    public int getOnlinePlayers()
    public int getServerProtocolNumber()
    public int getProtocolNumber()
    public long getPing()
    public String getVersion()
    public String getProtocolVersion()
    public String getStringJson()
    public MCServerModInfo getModInfo()
    public MCServerMotd getMotd()
    public MCServerSample getSample()
    public MCServerIcon getIcon()
    public boolean isMCServer()
    public boolean supportVersion()
    public static MCServerStatus getStatus(MCServerSocket mcsocket) throws SocketException
    public static MCServerStatus getStatus(MCServerSocket mcsocket, ProtocolVersion version) throws SocketException

    studio.trc.minecraft.serverpinglib.API.MCServerSample: Get the Server Samples
    public List<SampleText> getSampleList()
    public boolean hasSample()
    Inner Class:
    public String getID()
    public String getName()
    public String get(SampleEnum object)
    public String getColorID()
    public String getColorName()
    public String getColor(SampleEnum object)

    studio.trc.minecraft.serverpinglib.API.MCServerModInfo: Get the Server Mods
    public boolean hasModInfo()
    public boolean hasMod()
    public String getModType()
    public List<MCMod> getModList()
    Inner Class:
    public String getVersion()
    public String getModId()

    studio.trc.minecraft.serverpinglib.API.MCServerMotd: Get the Server MOTD information
    public String getMotdText()
    public String getColorMotdText()
    public String getLine1MotdText()
    public String getLine2MotdText()
    public String getLine1ColorMotd()
    public String getLine2ColorMotd()

    studio.trc.minecraft.serverpinglib.API.MCServerIcon: Get the Server Icon
    public void saveImageFile(File file)
    public void saveImageFile(String path)
    public boolean hasServerIcon()
    public String getBase64Image()
    public byte[] getImageBytes()

    Code (Text):

        public static void main(String[] args) {
            MCServerSocket socket = MCServerSocket.getInstance("", 25565);
            if (socket == null) {
                System.out.println("Can't connect to server!");
            MCServerStatus status = socket.getStatus(ProtocolVersion.v1_8_X);
            if (!status.isMCServer()) {
                System.out.println("This is not a MineCraft server.");
            System.out.println("Server IP: " + socket.getIP() + ":" + socket.getPort());
            System.out.println("SRV domain name resolution: " + socket.isSRVDomainName());
            System.out.println("Server Version: " + status.getVersion());
            System.out.println("Your protocol number: " + status.getProtocolNumber());
            System.out.println("Target server protocol number: " + status.getServerProtocolNumber());
            System.out.println("Protocol Version: " + status.getProtocolVersion());
            System.out.println("Support this version: " + status.supportVersion());
            System.out.println("Max Online Players: " + status.getMaxPlayers());
            System.out.println("Now Online Players: " + status.getOnlinePlayers());
            if (status.getSample().hasSample()) {
                System.out.println("Sample: ");
                for (SampleText st : status.getSample().getSampleList()) {
            System.out.println("MOTD: ");
            if (status.getIcon().hasServerIcon()) {
                System.out.println("Saved server Icon to D:/Test/Hypixel.png");
            if (status.getModInfo().hasModInfo()) {
                if (status.getModInfo().hasMod()) {
                    for (MCMod mods : status.getModInfo().getModList()) {
                        System.out.println(mods.getModId() + ", v" + mods.getVersion());

    In the above code, is the IP address of the famous server Hypixel. You can replace it with the IP address of other servers and get their information.
    PS: It is recommended not to use the method of
    MCServerSocket. getInstance(String ip, int port) in the main thread. If the target server connection takes too long, it may cause the main thread to be unresponsive for a long time or even cause other unnecessary consequences.

    Server IP:
    SRV domain name resolution: false
    Server Version: Requires MC 1.8-1.14
    Your protocol number: 47
    Target server protocol number: 47
    Protocol Version: 1.8.X
    Support this version: true
    Max Online Players: 76000
    Now Online Players: 73223
    Hypixel Network [1.8-1.14]
    Saved server Icon to D:/Test/Hypixel.png

    Save icons: (example):
    Other classes:
    ProtocolNumber: Number of Control Protocol
    ProtocolVersion: Version Enumeration
    ProtocolPacket: Protocol Packets for Reading Information
    Encoding: Setting the encoding of the return stream
    XiaoPangxie732 likes this.

Recent Reviews

  1. xiongliu
    Version: 1.1.4
    Awesome plugin! Never had any issues with it whatsoever. Amazing Developer. keep at it!
  2. Panakvina321
    Version: 1.1.4
    Wow you are god bro ! Amazing api thanks you so much for this work. It works nice :) Thanks!