mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 01:29:55 +00:00
Really minor changes.
This commit is contained in:
parent
f5989d461c
commit
aefcab9a49
@ -45,9 +45,6 @@ class PermissionsAPI{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
ServerAPI::request()->api->addHandler("player.connect", function ($player)//Use a better event than player.connect. Player.create maybe?
|
ServerAPI::request()->api->addHandler("player.connect", function ($player)//Use a better event than player.connect. Player.create maybe?
|
||||||
@ -60,6 +57,11 @@ class PermissionsAPI{
|
|||||||
$player->permission = new DefaultPermission();
|
$player->permission = new DefaultPermission();
|
||||||
}
|
}
|
||||||
}, 1);//Experimental. Use Closure / Anonymous Functions to assign new functions from each API rather than hard-coding them to Player.php.
|
}, 1);//Experimental. Use Closure / Anonymous Functions to assign new functions from each API rather than hard-coding them to Player.php.
|
||||||
|
|
||||||
|
ServerAPI::request()->api->addHandler("player.connect", function ($player)
|
||||||
|
{
|
||||||
|
|
||||||
|
}, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ class ServerAPI{
|
|||||||
private $rcon;
|
private $rcon;
|
||||||
private $query;
|
private $query;
|
||||||
|
|
||||||
|
//TODO: Instead of hard-coding functions, use PHPDoc-compatible methods to load APIs.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ConsoleAPI
|
* @var ConsoleAPI
|
||||||
*/
|
*/
|
||||||
|
@ -85,7 +85,10 @@ class PocketMinecraftServer{
|
|||||||
$this->load();
|
$this->load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTPS(){
|
/**
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getTPS(){
|
||||||
$v = array_values($this->tickMeasure);
|
$v = array_values($this->tickMeasure);
|
||||||
$tps = 40 / ($v[39] - $v[0]);
|
$tps = 40 / ($v[39] - $v[0]);
|
||||||
return round($tps, 4);
|
return round($tps, 4);
|
||||||
@ -179,7 +182,10 @@ class PocketMinecraftServer{
|
|||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function close($reason = "server stop"){
|
/**
|
||||||
|
* @param string $reason
|
||||||
|
*/
|
||||||
|
public function close($reason = "server stop"){
|
||||||
if($this->stop !== true){
|
if($this->stop !== true){
|
||||||
if(is_int($reason)){
|
if(is_int($reason)){
|
||||||
$reason = "signal stop";
|
$reason = "signal stop";
|
||||||
@ -271,7 +277,14 @@ class PocketMinecraftServer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addHandler($event,callable $callable, $priority = 5){
|
/**
|
||||||
|
* @param string $event
|
||||||
|
* @param callable $callable
|
||||||
|
* @param integer $priority
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function addHandler($event,callable $callable, $priority = 5){
|
||||||
if(!is_callable($callable)){
|
if(!is_callable($callable)){
|
||||||
return false;
|
return false;
|
||||||
}elseif(isset(Deprecation::$events[$event])){
|
}elseif(isset(Deprecation::$events[$event])){
|
||||||
@ -339,7 +352,10 @@ class PocketMinecraftServer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGamemode(){
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getGamemode(){
|
||||||
switch($this->gamemode){
|
switch($this->gamemode){
|
||||||
case SURVIVAL:
|
case SURVIVAL:
|
||||||
return "survival";
|
return "survival";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user