An RCON client library for Java and Kotlin.
rcon4j-core
: in pure Java 8. Connect with Socket.rcon4j-kotlin
: in Kotlin. Connect with ktor-network-jvm library and Kotlin coroutines.
- Include the JitPack repository to your project, example (
build.gradle.kts
):repositories { mavenCentral() maven("https://jitpack.io") }
- Import the library with a proper version:
dependencies { implementation("com.github.MukjepScarlet.rcon4j:rcon4j-kotlin:$version") implementation("com.github.MukjepScarlet.rcon4j:rcon4j-core:$version") }
public RconClient(
String host,
int port,
String password,
Charset charset, // default=StandardCharsets.UTF_8
int requestId // default=(new Random()).nextInt(Integer.MAX_VALUE) + 1
) throws IOException, AuthenticationException
// RconClient implements AutoCloseable
// Member
@NotNull
public String command(
String payload
)
throws IOException
suspend fun ARconClient(
host: String,
port: Int,
password: String,
charset: Charset = Charsets.UTF_8,
requestId: Int = Random.nextInt(0, Int.MAX_VALUE) + 1,
dispatcher: CoroutineDispatcher = Dispatchers.IO,
): ARconClient
// ARconClient implements AutoCloseable
// Member
public final suspend fun command(
payload: String
): String