line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
28442
|
use v5.16; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
120
|
|
2
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
94
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Net::Minecraft::Login { |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Basic implementation of the Minecraft Login Protocol. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
2126
|
use Moo; |
|
2
|
|
|
|
|
37799
|
|
|
2
|
|
|
|
|
14
|
|
10
|
|
|
|
|
|
|
with 'Net::Minecraft::Role::HTTP'; |
11
|
2
|
|
|
2
|
|
3817
|
use Carp qw( confess ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
129
|
|
12
|
2
|
|
|
2
|
|
11
|
use Scalar::Util qw( blessed ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
177
|
|
13
|
2
|
|
|
2
|
|
2133
|
use Params::Validate qw( validate SCALAR ); |
|
2
|
|
|
|
|
15345
|
|
|
2
|
|
|
|
|
164
|
|
14
|
2
|
|
|
2
|
|
1137
|
use Net::Minecraft::LoginResult; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
84
|
|
15
|
2
|
|
|
2
|
|
1466
|
use Net::Minecraft::LoginFailure; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
730
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has login_server => ( is => rwp =>, lazy => 1, default => sub { return 'https://login.minecraft.net/' }, ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
## no critic ( ProhibitMagicNumbers ) |
22
|
|
|
|
|
|
|
has version => ( is => rwp =>, lazy => 1, default => sub { 13 }, ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _do_request { |
26
|
0
|
|
|
0
|
|
0
|
my ( $self, $base_uri, $parameters, $config ) = @_; |
27
|
0
|
|
|
|
|
0
|
my $uri = sprintf q{%s?%s}, $base_uri, $self->http_engine->www_form_urlencode($parameters); |
28
|
0
|
|
|
|
|
0
|
return $self->http_engine->request( GET => $uri, $config ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub login { |
34
|
8
|
|
|
8
|
1
|
24037
|
my ( $self, @args ) = @_; |
35
|
8
|
|
|
|
|
204
|
my %params = validate( |
36
|
|
|
|
|
|
|
@args => { |
37
|
|
|
|
|
|
|
user => { type => SCALAR }, |
38
|
|
|
|
|
|
|
password => { type => SCALAR }, |
39
|
|
|
|
|
|
|
version => { type => SCALAR, default => $self->version }, |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
); |
42
|
2
|
|
|
|
|
36
|
my $result = $self->_do_request( $self->login_server, \%params, { headers => $self->http_headers }, ); |
43
|
2
|
50
|
|
|
|
22
|
if ( not $result->{success} ) { |
44
|
0
|
|
|
|
|
0
|
my $failure = Net::Minecraft::LoginFailure->new( |
45
|
|
|
|
|
|
|
code => $result->{status}, |
46
|
|
|
|
|
|
|
reason => $result->{reason}, |
47
|
|
|
|
|
|
|
); |
48
|
0
|
|
|
|
|
0
|
return $failure; |
49
|
|
|
|
|
|
|
} |
50
|
2
|
|
|
|
|
15
|
return Net::Minecraft::LoginResult->parse( $result->{content} ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
BEGIN { |
54
|
2
|
|
|
2
|
|
93
|
$Net::Minecraft::Login::AUTHORITY = 'cpan:KENTNL'; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
{ |
57
|
|
|
|
|
|
|
$Net::Minecraft::Login::VERSION = '0.002000'; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |