mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 09:49:50 +00:00
Merge branch 'master' into mcpe-1.0
This commit is contained in:
commit
478a62e17b
@ -523,20 +523,18 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
}
|
||||
|
||||
public function sendCommandData(){
|
||||
$pk = new AvailableCommandsPacket();
|
||||
$data = new \stdClass();
|
||||
$count = 0;
|
||||
foreach($this->server->getCommandMap()->getCommands() as $command){
|
||||
//TODO: fix command permission checks on join
|
||||
/*if(!$command->testPermissionSilent($this)){
|
||||
continue;
|
||||
}*/
|
||||
++$count;
|
||||
$data->{$command->getName()}->versions[0] = $command->generateCustomCommandData($this);
|
||||
if(($cmdData = $command->generateCustomCommandData($this)) !== null){
|
||||
++$count;
|
||||
$data->{$command->getName()}->versions[0] = $cmdData;
|
||||
}
|
||||
}
|
||||
|
||||
if($count > 0){
|
||||
//TODO: structure checking
|
||||
$pk = new AvailableCommandsPacket();
|
||||
$pk->commands = json_encode($data);
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
|
@ -470,9 +470,18 @@ namespace pocketmine {
|
||||
exit(1); //Exit with error
|
||||
}
|
||||
|
||||
if(file_exists(\pocketmine\PATH . ".git/refs/heads/master")){ //Found Git information!
|
||||
define('pocketmine\GIT_COMMIT', strtolower(trim(file_get_contents(\pocketmine\PATH . ".git/refs/heads/master"))));
|
||||
}else{ //Unknown :(
|
||||
if(file_exists(\pocketmine\PATH . ".git/HEAD")){ //Found Git information!
|
||||
$ref = trim(file_get_contents(\pocketmine\PATH . ".git/HEAD"));
|
||||
if(preg_match('/^[0-9a-f]{40}$/i', $ref)){
|
||||
define('pocketmine\GIT_COMMIT', strtolower($ref));
|
||||
}elseif(substr($ref, 0, 5) === "ref: "){
|
||||
$refFile = \pocketmine\PATH . ".git/" . substr($ref, 5);
|
||||
if(is_file($refFile)){
|
||||
define('pocketmine\GIT_COMMIT', strtolower(trim(file_get_contents($refFile))));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!defined('pocketmine\GIT_COMMIT')){ //Unknown :(
|
||||
define('pocketmine\GIT_COMMIT', str_repeat("00", 20));
|
||||
}
|
||||
|
||||
|
@ -108,13 +108,13 @@ abstract class Command{
|
||||
*/
|
||||
public function generateCustomCommandData(Player $player){
|
||||
//TODO: fix command permission filtering on join
|
||||
/*if(!$this->testPermission($player)){
|
||||
/*if(!$this->testPermissionSilent($player)){
|
||||
return null;
|
||||
}*/
|
||||
$customData = clone $this->commandData;
|
||||
$customData->aliases = $this->getAliases();
|
||||
/*foreach($customData->overloads as &$overload){
|
||||
if(($p = @$overload->pocketminePermission) !== null and !$player->hasPermission($p)){
|
||||
if(isset($overload->pocketminePermission) and !$player->hasPermission($overload->pocketminePermission)){
|
||||
unset($overload);
|
||||
}
|
||||
}*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user