Net::RCON::Minecraft::Response - Minecraft RCON command response
Version 0.04
use Net::RCON::Minecraft; my $response = eval { $rcon->command($command) }; if ($response) { print "Response: " . $response->ansi . "\n"; logger "Response: " . $response->plain; logger "Response: " . $response; # Stringifies to $response->plain; }
This module encapsulates a command response from a Minecraft server. You would not normally create one of these objects yourself; they are generated from Net::RCON::Minecraft's command() method.
command()
Minecraft servers return commands in a format that may include Minecraft color codes, so this module provides methods to strip or convert those codes as needed. At the time of release, vanilla Minecraft servers do not ever transmit color codes to RCON results, but modded servers such as Bukkit do.
If all you need is the plaintext response with color codes stripped, in most cases you can just use $response as a string. The object is overloaded to return $response->plain in such cases.
$response
$response->plain
This is called automatically by command() in Net::RCON::Minecraft.
Net::RCON::Minecraft
Creates a new RCON command response with the given raw command response text, and request ID.
Returns the unaltered raw command response.
$raw = $response->raw;
Returns the command response with all color codes removed.
$plain = $response->plain;
Returns the command response with color codes converted to ANSI escape sequences, suitable for displaying in a terminal.
$ansi = $response->ansi;
Returns the numerical request ID that this response was for. These IDs are generated automatically by Net::RCON::Minecraft, and there is normally no need to know them, but this may be useful for debugging.
Ryan Thompson <rjt@cpan.org>
Copyright 2019 Ryan Thompson
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
http://dev.perl.org/licenses/artistic.html
To install Net::RCON::Minecraft, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::RCON::Minecraft
CPAN shell
perl -MCPAN -e shell install Net::RCON::Minecraft
For more information on module installation, please visit the detailed CPAN module installation guide.