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 <austin@codebeard.com> |
40: | */ |
41: | class Minecraft extends Gamespy3 |
42: | { |
43: | /** |
44: | * String name of this protocol class |
45: | * |
46: | * @var string |
47: | */ |
48: | protected $name = 'minecraft'; |
49: | |
50: | /** |
51: | * Longer string name of this protocol class |
52: | * |
53: | * @var string |
54: | */ |
55: | protected $name_long = "Minecraft"; |
56: | |
57: | /** |
58: | * The client join link |
59: | * |
60: | * @var string |
61: | */ |
62: | protected $join_link = "minecraft://%s:%d/"; |
63: | |
64: | /** |
65: | * Normalize settings for this protocol |
66: | * |
67: | * @var array |
68: | */ |
69: | protected $normalize = [ |
70: | // General |
71: | 'general' => [ |
72: | // target => source |
73: | 'dedicated' => 'dedicated', |
74: | 'gametype' => 'game_id', |
75: | 'hostname' => 'hostname', |
76: | 'mapname' => 'map', |
77: | 'maxplayers' => 'maxplayers', |
78: | 'numplayers' => 'numplayers', |
79: | 'password' => 'password', |
80: | ], |
81: | // Individual |
82: | 'player' => [ |
83: | 'name' => 'player', |
84: | ], |
85: | ]; |
86: | } |
87: |