mc_rcon 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 51

mc_rcon #

A library for sending commands to Minecraft servers using the rcon protocol.

This package has only been tested with Minecraft servers, so it might not work with any other game server, PRs are welcome.

Also, this package doesn't support multi-packet responses from the server, the other packets will just be ignored.

Usage #

A simple usage example:

import 'package:mc_rcon/mc_rcon.dart';

main() {
  // connect to server
  Rcon rcon = await Rcon.createAndConnect("localhost", 25575, "password");
  
  // send command
  String res = await rcon.sendCommand("help");
  print(res);

  // close connection
  rcon.disconnect();
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1.0.0 #

  • First version, implemented base functionality (connect and send commands)

example/mc_rcon_example.dart

import 'package:mc_rcon/mc_rcon.dart';

main() async {
  Rcon rcon;
  try {
    // connect to the Minecraft server
    rcon = await Rcon.createAndConnect("localhost", 25575, "password");
  } on AuthenticationFailedException {
    print("wrong password");
  }

  // send "/help" command and print result
  String res = await rcon.sendCommand("help");
  print(res);

  // close connection
  rcon.disconnect();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  mc_rcon: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:mc_rcon/mc_rcon.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
11
Health:
Code health derived from static analysis. [more]
91
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
92
Overall:
Weighted score of the above. [more]
51
Learn more about scoring.

We analyzed this package on Jan 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.4

Health suggestions

Fix lib/src/packet.dart. (-3.93 points)

Analysis of lib/src/packet.dart reported 8 hints, including:

line 39 col 33: Avoid const keyword.

line 40 col 30: Avoid const keyword.

line 41 col 32: Avoid const keyword.

line 42 col 23: Avoid const keyword.

line 66 col 22: Unnecessary new keyword.

Fix lib/src/mc_rcon_base.dart. (-3.45 points)

Analysis of lib/src/mc_rcon_base.dart reported 7 hints, including:

line 57 col 17: Unnecessary new keyword.

line 68 col 13: Unnecessary new keyword.

line 89 col 13: Unnecessary new keyword.

line 97 col 25: Unnecessary new keyword.

line 111 col 17: Unnecessary new keyword.

Fix lib/src/util.dart. (-1.49 points)

Analysis of lib/src/util.dart reported 3 hints:

line 6 col 36: Unnecessary new keyword.

line 22 col 17: Unnecessary new keyword.

line 22 col 48: Unnecessary new keyword.

Format lib/src/exceptions.dart.

Run dartfmt to format lib/src/exceptions.dart.

Maintenance suggestions

The package description is too short. (-8 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0