WebFreak001 / McRcD

A tiny Minecraft Rcon library for D

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

McRcD

A tiny Minecraft Rcon library for D.

Usage

import mcrcd;
import std.stdio;

// Interactive Rcon console
void main(string[] args)
{
	auto rcon = new MCRcon();

	try
	{
		// Will connect to localhost:25575 or throw an exception if an error occurs
		rcon.connect("localhost", 25575);
	}
	catch(Exception e)
	{
		writeln("Couldn't connect!");
		writeln(e);
		return;
	}
	scope(exit) rcon.disconnect();

	// Login to Rcon
	rcon.login("password");

	while(true)
	{
		write("> ");
		MCRconResponse response = rcon.command(readln().strip());
		// MCRconResponse.unformatted automatically removes all text formatting/color codes (§code)
		writeln("  ", response.unformatted);
	}
}

generated using MaterialDoc

About

A tiny Minecraft Rcon library for D

License:The Unlicense


Languages

Language:D 87.2%Language:Shell 12.8%