A Dart SDK for interacting with a Minecraft server using the RCON protocol. Package on pub.dev
Features
Provides an API to connect to, log in to, send commands to, and receive data from a Minecraft server via the RCON protocol.
Getting started
Run flutter pub add mc_rcon_dart
or add the following to your pubspec.yaml:
dependencies:
mc_rcon_dart: ^<current_version>
Usage
See the example below. Full code example also in example.dart.
import 'package:flutter/foundation.dart';
import 'package:mc_rcon_dart/mc_rcon_dart.dart';
main() async {
await createSocket("172.30.80.31", port: 25575);
listen(onData);
login("123");
sendCommand("time set 0");
close();
}
void onData(Uint8List data) {
print(String.fromCharCodes(data, 12));
}
Additional information
- The RCON documentation is here.
- The documentation for Minecraft console commands is here.
- The documentation for Socket (as of 2.18.1), which is used to communicate with the RCON server, is here.
- Report bugs by making a new issue or send a merge request with the fix, but I’m pretty sure this is all working as is, and I don’t expect the RCON protocol to change.