Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mukjepscarlet/rcon4j
Rcon client for Java and Kotlin, available for Minecraft/Factorio
https://github.com/mukjepscarlet/rcon4j
coroutines factorio java kotlin minecraft rcon
Last synced: 1 day ago
JSON representation
Rcon client for Java and Kotlin, available for Minecraft/Factorio
- Host: GitHub
- URL: https://github.com/mukjepscarlet/rcon4j
- Owner: MukjepScarlet
- License: mit
- Created: 2025-01-14T14:02:44.000Z (12 days ago)
- Default Branch: master
- Last Pushed: 2025-01-22T09:59:00.000Z (4 days ago)
- Last Synced: 2025-01-22T10:31:57.707Z (4 days ago)
- Topics: coroutines, factorio, java, kotlin, minecraft, rcon
- Language: Java
- Homepage:
- Size: 67.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rcon4j [![](https://jitpack.io/v/MukjepScarlet/rcon4j.svg)](https://jitpack.io/#MukjepScarlet/rcon4j)
An RCON client library for Java and Kotlin.
## Modules
- `rcon4j-core`: in pure Java 8. Connect with Socket.
- `rcon4j-kotlin`: in Kotlin. Connect with [ktor-network-jvm](https://github.com/ktorio/ktor/tree/main/ktor-network/jvm) library and Kotlin coroutines.## Usage
1. Include the JitPack repository to your project, example (`build.gradle.kts`):
```kotlin
repositories {
mavenCentral()
maven("https://jitpack.io")
}
```
2. Import the library with a proper version:
```kotlin
dependencies {
implementation("com.github.MukjepScarlet.rcon4j:rcon4j-kotlin:$version")
implementation("com.github.MukjepScarlet.rcon4j:rcon4j-core:$version")
}
```## Overview
### Java module
```java
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
```### Kotlin module
```kotlin
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
```