line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::RCON::Minecraft::Response; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Minecraft command response |
4
|
|
|
|
|
|
|
|
5
|
11
|
|
|
11
|
|
284
|
use 5.010; |
|
11
|
|
|
|
|
45
|
|
6
|
11
|
|
|
11
|
|
67
|
use Mouse; |
|
11
|
|
|
|
|
29
|
|
|
11
|
|
|
|
|
64
|
|
7
|
11
|
|
|
11
|
|
4215
|
use Mouse::Util::TypeConstraints; |
|
11
|
|
|
|
|
28
|
|
|
11
|
|
|
|
|
76
|
|
8
|
11
|
|
|
11
|
|
8929
|
use Term::ANSIColor; |
|
11
|
|
|
|
|
103806
|
|
|
11
|
|
|
|
|
1024
|
|
9
|
11
|
|
|
11
|
|
101
|
use Carp; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
758
|
|
10
|
11
|
|
|
11
|
|
86
|
no warnings 'uninitialized'; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
1470
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
13
|
|
|
|
|
|
|
|
14
|
65
|
|
|
65
|
|
28788
|
use overload q("") => sub { shift->plain }, |
15
|
1
|
|
|
1
|
|
615
|
'++' => sub { $_[0] = $_[0]->plain + 1 }, |
16
|
1
|
|
|
1
|
|
1063
|
'--' => sub { $_[0] = $_[0]->plain - 1 }, |
17
|
11
|
|
|
11
|
|
5512
|
fallback => 1; |
|
11
|
|
|
|
|
3987
|
|
|
11
|
|
|
|
|
141
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Minecraft -> ANSI color map |
20
|
|
|
|
|
|
|
my %COLOR = map { $_->[1] => color($_->[0]) } ( |
21
|
|
|
|
|
|
|
[black => '0'], [blue => '1'], [green => '2'], |
22
|
|
|
|
|
|
|
[cyan => '3'], [red => '4'], [magenta => '5'], |
23
|
|
|
|
|
|
|
[yellow => '6'], [white => '7'], [bright_black => '8'], |
24
|
|
|
|
|
|
|
[bright_blue => '9'], [bright_green => 'a'], [bright_cyan => 'b'], |
25
|
|
|
|
|
|
|
[bright_red => 'c'], [bright_magenta => 'd'], [yellow => 'e'], |
26
|
|
|
|
|
|
|
[bright_white => 'f'], |
27
|
|
|
|
|
|
|
[bold => 'l'], [concealed => 'm'], [underline => 'n'], |
28
|
|
|
|
|
|
|
[reverse => 'o'], [reset => 'r'], |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has id => ( is => 'ro', isa => 'Int' ); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has raw => ( is => 'ro', isa => 'Str' ); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has plain => ( is => 'ro', isa => 'Str', lazy => 1, default => sub { |
36
|
|
|
|
|
|
|
my $raw = $_[0]->raw; |
37
|
|
|
|
|
|
|
$raw =~ s/\x{00A7}.//g; |
38
|
|
|
|
|
|
|
$raw; |
39
|
|
|
|
|
|
|
}); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has ansi => ( is => 'ro', isa => 'Str', lazy => 1, default => sub { |
42
|
|
|
|
|
|
|
local $_ = $_[0]->raw; |
43
|
|
|
|
|
|
|
s/\x{00A7}(.)/$COLOR{$1}/g; |
44
|
|
|
|
|
|
|
$_ . $COLOR{r}; |
45
|
|
|
|
|
|
|
}); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |