Minecraft::ServerStatus - A Minecraft server status checker
Version 1.0.1
use Minecraft::ServerStatus; $ms = Minecraft::ServerStatus::init("minecraft.frag.land", 25565); print "Minecraft server status of $ms->{address} on port $ms->{port}:\n"; if($ms->{online}) { print "Server is online running version $ms->{version} with $ms->{current_players} out of $ms->{max_players} players.\n"; print "Message of the day: $ms->{motd}\n"; print "Latency: $ms->{latency}ms\n"; } else { print "Server is offline!\n"; }
Minecraft::ServerStatus provides an interface to query Minecraft servers. The data returned includes the remote server's message of the day (MotD), current players, maximum players, version, and latency.
Minecraft::ServerStatus
To install this module:
perl Makefile.PL make make install
Minecraft::ServerStatus::init("minecraft.frag.land", 25565);
The above function connects to the specified Minecraft server using the address and port. You may also specify the TCP timeout:
Minecraft::ServerStatus::init("minecraft.frag.land", 25565, 3);
The default TCP timeout value is 5 seconds.
<ldilley@cpan.org>
Copyright (C) 2016-2021 Lloyd Dilley
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
To install Minecraft::ServerStatus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Minecraft::ServerStatus
CPAN shell
perl -MCPAN -e shell install Minecraft::ServerStatus
For more information on module installation, please visit the detailed CPAN module installation guide.