2017 © Pedro Peláez
 

library minecraft-auth

Fake Minecraft server for authentication checking

image

publicuhc/minecraft-auth

Fake Minecraft server for authentication checking

  • Tuesday, June 14, 2016
  • by Eluinhost
  • Repository
  • 3 Watchers
  • 22 Stars
  • 127 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

minecraft-auth

SensioLabsInsight, (*1)

PHP Library for running a 'fake' Minecraft server that checks authentications are correct with the session servers and kicks the player afterwards. Has a callback to change the disconnect message. I use if for verification codes to link minecraft accounts without needing them to input their password., (*2)

Install

Install via composer by adding "publicuhc/minecraft-auth": "dev-master" to your composer require., (*3)

Dependencies: Will be handled by composer on install, requires the PHP mcrypt extension to run. (You can install this on linux with apt-get install php5-mcrypt or similar), (*4)

Example Usage

use PublicUHC\MinecraftAuth\AuthServer\AuthServer;

$server = new AuthServer(25565, '0.0.0.0');

$server->on('login_success', function($username, $uuid, DisconnectPacket $packet){
    echo "USERNAME: $username, UUID: $uuid\n";
    $packet->setReason("USERNAME: $username, UUID: $uuid");
});

$server->on('status_request', function(StatusResponsePacket $packet) {
    $packet->setDescription('test server')
        ->setMaxPlayers(10)
        ->setOnlineCount(1000)
        ->setVersion('1.8+')
        ->setProtocol(47);
});

$server->start();

Explanation

new AuthServer(25565, '0.0.0.0');

Creates a new auth server to bind on the port 25565 and on all interfaces (0.0.0.0). If second parameter is ommited it will bind to 127.0.0.1 for localhost connections., (*5)

$server->on('login_success', function($username, $uuid, DisconnectPacket $packet){
    echo "USERNAME: $username, UUID: $uuid\n";
    $packet->setReason("USERNAME: $username, UUID: $uuid");
});

This is the login_success event. It is called whenever a successful connection has been made. Username is the username of the client connecting, UUID is the minecraft UUID (without -s). $packet is a DisconnectPacket object that will be sent to the client after the event. Use setReason (to set an array/string reason that will be json encoded before sending) or setReasonJSON (to set a pre-encoded json string)., (*6)

$server->on('status_request', function(StatusResponsePacket $packet) {
    $packet->setDescription('test')
        ->setMaxPlayers(10)
        ->setOnlineCount(1000)
        ->setVersion('1.8+')
        ->setProtocol(47);
        ->setOnlinePlayers([
            [
                'name' => 'Eluinhost',
                'id'   => '000000000000-0000-0000-0000-00000000'
            ]
        ]);
});

This is the status_request event. It is called whenever a client requests data for the server list., (*7)

->setDescription(string); - Sets the description that shows up in the server list
->setMaxPlayers(int) - the number after the / on the list
->setOnlineCount(int) - the number before the / on the list
->setVersion(string) - If the client is connecting on a different protocol this version number will show instead of min/max players
->setProtocol(47) - The protocol version to set to, we only accept 47 so either set this to 47 or leave it out ->setOnlinePlayers(array) - An array of player names to show when hovering over the online count. For array format check the PHPDoc comment
->setFavicon(string) - The image in text format (i.e. data:image/png;base64,DATAHERE), (*8)

All of the method can be ignored. If they are not set the following will be set instead:, (*9)

->setDescription(string); - Default: §4▁§e▂§4▃§e▄§4▅§e▆§4▇§e█ §4§l PHPAuthServer §e█§4▇§e▆§4▅§e▄§4▃§e▂§4▁ §c▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
->setMaxPlayers(int) - Default: -1
->setOnlineCount(int) - Default: -1
->setVersion(string) - Default: 1.8+ ->setProtocol(47) - Default: 47 ->setOnlinePlayers(array) - Default: []
->setFavicon(string) - Default: null (no favicon), (*10)

Due to the single thread nature of PHP all events will be blocking other code. If you run any long running processes in here it will stop processing other connections until it is complete. Either keep computation low or fork processes to run long running code., (*11)

`$server->start()`

Starts the server, nothing after this method will be called as it blocking, make sure to run everything you need before this., (*12)

The Versions

14/06 2016

dev-master

9999999-dev

Fake Minecraft server for authentication checking

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

by Graham Howden

authentication auth minecraft minecraft server phpauthserver yggdrasil auth server

18/07 2015

1.1.1

1.1.1.0

Fake Minecraft server for authentication checking

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

by Graham Howden

authentication auth minecraft minecraft server phpauthserver yggdrasil auth server

12/03 2015

1.1.0

1.1.0.0

Fake Minecraft server for authentication checking

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

by Graham Howden

authentication auth minecraft minecraft server phpauthserver yggdrasil auth server

22/07 2014

1.0.3

1.0.3.0

Fake Minecraft server for authentication checking

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

by Graham Howden

authentication auth minecraft minecraft server phpauthserver yggdrasil auth server

13/07 2014

dev-releases/1.0

dev-releases/1.0

Fake Minecraft server for authentication checking

  Sources   Download

GPLv3

The Requires

 

The Development Requires

by Graham Howden

authentication auth minecraft minecraft server phpauthserver yggdrasil auth server

13/07 2014

1.0.2

1.0.2.0

Fake Minecraft server for authentication checking

  Sources   Download

GPLv3

The Requires

 

The Development Requires

by Graham Howden

authentication auth minecraft minecraft server phpauthserver yggdrasil auth server

20/06 2014

1.0.1

1.0.1.0

Fake Minecraft server for authentication checking

  Sources   Download

GPLv3

The Requires

 

The Development Requires

by Graham Howden

authentication auth minecraft minecraft server phpauthserver yggdrasil auth server

20/06 2014

1.0.0

1.0.0.0

Fake Minecraft server for authentication checking

  Sources   Download

GPLv3

The Requires

 

The Development Requires

by Graham Howden

authentication auth minecraft minecraft server phpauthserver yggdrasil auth server