add Java 15v add MIT Lisence add ..
Steam4J is an open-source project that strives provides full wrapping of game server queries.
This project requires JDK 11+
Maven dependencies in the project:
The list of the features currently implemented in the project:
Download project from release page of the project
or
Add dependency to your project manager
Maven:
<dependency>
<artefactId>com.antonio112009</artefactId>
<groupId>steam4j</groupId>
<version>1.0.0</version>
</dependency>
Execute single command:
public class SendingSingleCommand {
public static void main(String[] args) {
Rcon rcon = new Rcon("0.0.0.0", 21114);
rcon.openStream();
boolean isAuthenticated = rcon.authenticate(password);
if(isAuthenticated) {
String answerFromServer = rcon.sendCommand("ListPlayers");
System.out.println("Answer: " + answerFromServer);
}
rcon.closeStream(); //optional if it's in the end of the program
}
}
Execute multiple command:
public class SendingMultipleCommand {
public static void main(String[] args) {
Rcon rcon = new Rcon("0.0.0.0", 21114);
rcon.openStream();
boolean isAuthenticated = rcon.authenticate(password);
if(isAuthenticated) {
System.out.println("Answer1: " + rcon.sendCommand("ListPlayers"));
System.out.println("Answer2: " + rcon.sendCommand("GetCurrentScore"));
System.out.println("Answer3: " + rcon.sendCommand("ChatToAll Hello world!"));
System.out.println("Answer: " + answerFromServer);
}
rcon.closeStream(); //optional if it's in the end of the program
}
}
Receiving non-stop messages from a server (no execution of commands). Usually console logs:
public class ReceiveServerLogs {
public static void main(String[] args) {
Rcon rcon = new Rcon("0.0.0.0", 21114);
rcon.openStream();
boolean isAuthenticated = rcon.authenticate(password);
while (isAuthenticated) {
try {
System.out.println("Answer: " + rcon.receivingServerMessages());
} catch (IOException e) {
e.printStackTrace();
rcon.closeStream(); //optional if it's in the end of the program
break;
}
}
}
}
All objects represent response format of data that are shown in details on the official Valve developer page.
Getting information of the server. Read more here
public class GetServerInformation {
public static void main(String[] args) {
A2s a2s = new A2S("0.0.0.0", 27166);
ServerInfo serverInfo = a2S.getServerInfo();
System.out.println("Result:\n" + serverInfo.toString());
}
}
Getting information of the server. Read more here
public class GetServerInformation {
public static void main(String[] args) {
A2s a2s = new A2S("0.0.0.0", 27166);
Players players = a2S.getPlayers();
System.out.println("Result:\n" + players.toString());
}
}
Getting information of the server. Read more here
public class GetServerInformation {
public static void main(String[] args) {
A2s a2s = new A2S("0.0.0.0", 27166);
Rules rules = a2S.getRules();
System.out.println("Result:\n" + rules.toString());
}
}
The contribution template and format is currently under development. Anyway, you are welcome to contribute this project.