Class RconClient

java.lang.Object
com.github.theword.queqiao.tool.rcon.RconClient

public class RconClient extends Object
  • Field Details

    • client

      public volatile org.glavo.rcon.Rcon client
  • Constructor Details

    • RconClient

      public RconClient(org.slf4j.Logger logger, int port, String password)
  • Method Details

    • connect

      public void connect()
      尝试连接 Rcon,返回是否成功
    • sendCommand

      public String sendCommand(String command) throws IOException
      Throws:
      IOException
    • stop

      public void stop()
      关闭 Rcon 连接

      1. 先判断 client 是否为 null

      2. 调用 client.close()

      3. 捕获异常并打印日志

      4. 将 client 置为 null

      5. 打印关闭成功日志

    • isConnected

      public boolean isConnected()
    • setPort

      public void setPort(int port)
    • setPassword

      public void setPassword(String password)