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 dart pub add mc_rcon_dart
.
Alternatively, add the following to your pubspec.yaml:
dependencies:
mc_rcon_dart: ^1.1.0
Usage
Full code example in example.dart.
To import the package:
import 'package:mc_rcon_dart/mc_rcon_dart.dart';
To create the socket (typically want to await on the completion):
createSocket("172.30.80.31", port: 25575);
To set a listener on the socket (note that the handler function must take a List
listen(onData);
To log in to the RCON server:
login("123");
To send any command:
sendCommand("time set 0");
To close the connection:
close();
Additional information
- The RCON documentation is here.
- The documentation for Minecraft console commands is here.
- The documentation for Socket (as of Dart 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.