Completed
Push — v3 ( b6eaed...c78f50 )
by Austin
04:21
created

Minecraft::processResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * This file is part of GameQ.
4
 *
5
 * GameQ is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU Lesser General Public License as published by
7
 * the Free Software Foundation; either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * GameQ is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
namespace GameQ\Protocols;
20
21
/**
22
 * Minecraft Protocol Class
23
 *
24
 * Thanks to https://github.com/xPaw/PHP-Minecraft-Query for helping me realize this is
25
 * Gamespy 3 Protocol.  Make sure you enable the items below for it to work.
26
 *
27
 * Information from original author:
28
 * Instructions
29
 *
30
 * Before using this class, you need to make sure that your server is running GS4 status listener.
31
 *
32
 * Look for those settings in server.properties:
33
 *
34
 *    enable-query=true
35
 *    query.port=25565
36
 *
37
 * @package GameQ\Protocols
38
 *
39
 * @author  Austin Bischoff <[email protected]>
40
 */
41
class Minecraft extends Gamespy3
42
{
43
44
    /**
45
     * String name of this protocol class
46
     *
47
     * @type string
48
     */
49
    protected $name = 'minecraft';
50
51
    /**
52
     * Longer string name of this protocol class
53
     *
54
     * @type string
55
     */
56
    protected $name_long = "Minecraft";
57
58
    /**
59
     * The client join link
60
     *
61
     * @type string
62
     */
63
    protected $join_link = "minecraft://%s:%d/";
64
65
    /**
66
     * Normalize settings for this protocol
67
     *
68
     * @type array
69
     */
70
    protected $normalize = [
71
        // General
72
        'general' => [
73
            // target       => source
74
            'dedicated'  => 'dedicated',
75
            'gametype'   => 'game_id',
76
            'hostname'   => 'hostname',
77
            'mapname'    => 'map',
78
            'maxplayers' => 'maxplayers',
79
            'numplayers' => 'numplayers',
80
            'password'   => 'password',
81
        ],
82
        // Individual
83
        'player'  => [
84
            'name' => 'player',
85
        ],
86
    ];
87
}
88