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
|
|
|
|