Merge pull request #161 from pmmp/deprecate-version-constants

Deprecate Minecraft game version constants in the `pocketmine` root namespace
This commit is contained in:
SOFe 2016-12-19 21:21:38 +08:00 committed by GitHub
commit a122ea9e75
4 changed files with 16 additions and 4 deletions

View File

@ -65,6 +65,7 @@ namespace {
} }
namespace pocketmine { namespace pocketmine {
use pocketmine\network\protocol\Info as ProtocolInfo;
use pocketmine\utils\Binary; use pocketmine\utils\Binary;
use pocketmine\utils\MainLogger; use pocketmine\utils\MainLogger;
use pocketmine\utils\ServerKiller; use pocketmine\utils\ServerKiller;
@ -76,8 +77,6 @@ namespace pocketmine {
const VERSION = "1.6.1dev"; const VERSION = "1.6.1dev";
const API_VERSION = "2.1.0"; const API_VERSION = "2.1.0";
const CODENAME = "Unleashed"; const CODENAME = "Unleashed";
const MINECRAFT_VERSION = "v0.16.0.5 alpha";
const MINECRAFT_VERSION_NETWORK = "0.16.0.5";
/* /*
* Startup code. Do not look at it, it may harm you. * Startup code. Do not look at it, it may harm you.
@ -146,6 +145,16 @@ namespace pocketmine {
define('pocketmine\DATA', isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR); define('pocketmine\DATA', isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
define('pocketmine\PLUGIN_PATH', isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR); define('pocketmine\PLUGIN_PATH', isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
/**
* @deprecated This constant has moved to {@link \pocketmine\network\protocol\Info} and will be removed from here in the future.
*/
const MINECRAFT_VERSION = ProtocolInfo::MINECRAFT_VERSION;
/**
* @deprecated This constant has moved to {@link \pocketmine\network\protocol\Info} and will be removed from here in the future.
*/
const MINECRAFT_VERSION_NETWORK = ProtocolInfo::MINECRAFT_VERSION_NETWORK;
Terminal::init(); Terminal::init();
define('pocketmine\ANSI', Terminal::hasFormattingCodes()); define('pocketmine\ANSI', Terminal::hasFormattingCodes());

View File

@ -87,6 +87,7 @@ use pocketmine\network\Network;
use pocketmine\network\protocol\BatchPacket; use pocketmine\network\protocol\BatchPacket;
use pocketmine\network\protocol\CraftingDataPacket; use pocketmine\network\protocol\CraftingDataPacket;
use pocketmine\network\protocol\DataPacket; use pocketmine\network\protocol\DataPacket;
use pocketmine\network\protocol\Info as ProtocolInfo;
use pocketmine\network\protocol\PlayerListPacket; use pocketmine\network\protocol\PlayerListPacket;
use pocketmine\network\query\QueryHandler; use pocketmine\network\query\QueryHandler;
use pocketmine\network\RakLibInterface; use pocketmine\network\RakLibInterface;
@ -301,7 +302,7 @@ class Server{
* @return string * @return string
*/ */
public function getVersion(){ public function getVersion(){
return \pocketmine\MINECRAFT_VERSION; return ProtocolInfo::MINECRAFT_VERSION;
} }
/** /**

View File

@ -172,7 +172,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
$this->interface->sendOption("name", $this->interface->sendOption("name",
"MCPE;" . addcslashes($name, ";") . ";" . "MCPE;" . addcslashes($name, ";") . ";" .
Info::CURRENT_PROTOCOL . ";" . Info::CURRENT_PROTOCOL . ";" .
\pocketmine\MINECRAFT_VERSION_NETWORK . ";" . Info::MINECRAFT_VERSION_NETWORK . ";" .
$info->getPlayerCount() . ";" . $info->getPlayerCount() . ";" .
$info->getMaxPlayerCount() $info->getMaxPlayerCount()
); );

View File

@ -31,6 +31,8 @@ interface Info{
* Actual Minecraft: PE protocol version * Actual Minecraft: PE protocol version
*/ */
const CURRENT_PROTOCOL = 91; const CURRENT_PROTOCOL = 91;
const MINECRAFT_VERSION = "v0.16.0.5 alpha";
const MINECRAFT_VERSION_NETWORK = "0.16.0.5";
const LOGIN_PACKET = 0x01; const LOGIN_PACKET = 0x01;
const PLAY_STATUS_PACKET = 0x02; const PLAY_STATUS_PACKET = 0x02;