Minecraft.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. namespace GameQ\Protocols;
  19. /**
  20. * Minecraft Protocol Class
  21. *
  22. * Thanks to https://github.com/xPaw/PHP-Minecraft-Query for helping me realize this is
  23. * Gamespy 3 Protocol. Make sure you enable the items below for it to work.
  24. *
  25. * Information from original author:
  26. * Instructions
  27. *
  28. * Before using this class, you need to make sure that your server is running GS4 status listener.
  29. *
  30. * Look for those settings in server.properties:
  31. *
  32. * enable-query=true
  33. * query.port=25565
  34. *
  35. * @package GameQ\Protocols
  36. *
  37. * @author Austin Bischoff <[email protected]>
  38. */
  39. class Minecraft extends Gamespy3
  40. {
  41. /**
  42. * String name of this protocol class
  43. *
  44. * @type string
  45. */
  46. protected $name = 'minecraft';
  47. /**
  48. * Longer string name of this protocol class
  49. *
  50. * @type string
  51. */
  52. protected $name_long = "Minecraft";
  53. /**
  54. * The client join link
  55. *
  56. * @type string
  57. */
  58. protected $join_link = "minecraft://%s:%d/";
  59. /**
  60. * Normalize settings for this protocol
  61. *
  62. * @type array
  63. */
  64. protected $normalize = [
  65. // General
  66. 'general' => [
  67. // target => source
  68. 'dedicated' => 'dedicated',
  69. 'gametype' => 'game_id',
  70. 'hostname' => 'hostname',
  71. 'mapname' => 'map',
  72. 'maxplayers' => 'maxplayers',
  73. 'numplayers' => 'numplayers',
  74. 'password' => 'password',
  75. ],
  76. // Individual
  77. 'player' => [
  78. 'name' => 'player',
  79. ],
  80. ];
  81. }