mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 06:25:32 +00:00
Some PHPDoc comment updates.
This commit is contained in:
parent
2339525478
commit
68076fedc8
@ -52,10 +52,18 @@ class BanAPI{
|
||||
$this->server->addHandler("player.flying", array($this, "permissionsCheck"), 1);//Flying Event
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $cmd Command to Whitelist
|
||||
*/
|
||||
public function cmdWhitelist($cmd){//Whitelists a CMD so everyone can issue it - Even non OPs.
|
||||
$this->cmdWhitelist[strtolower(trim($cmd))] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isOp($username){//Is a player op?
|
||||
$username = strtolower($username);
|
||||
if($this->server->api->dhandle("op.check", $username) === true){
|
||||
@ -66,6 +74,12 @@ class BanAPI{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param string $event
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function permissionsCheck($data, $event){
|
||||
switch($event){
|
||||
case "player.flying"://OPs can fly around the server.
|
||||
@ -101,6 +115,14 @@ class BanAPI{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $cmd
|
||||
* @param array $params
|
||||
* @param string $issuer
|
||||
* @param string $alias
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function commandHandler($cmd, $params, $issuer, $alias){
|
||||
$output = "";
|
||||
switch($cmd){
|
||||
@ -275,22 +297,38 @@ class BanAPI{
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
*/
|
||||
public function ban($username){
|
||||
$this->commandHandler("ban", array("add", $username), "console", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
*/
|
||||
public function pardon($username){
|
||||
$this->commandHandler("ban", array("pardon", $username), "console", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ip
|
||||
*/
|
||||
public function banIP($ip){
|
||||
$this->commandHandler("banip", array("add", $ip), "console", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ip
|
||||
*/
|
||||
public function pardonIP($ip){
|
||||
$this->commandHandler("banip", array("pardon", $ip), "console", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
* @param string $reason
|
||||
*/
|
||||
public function kick($username, $reason = "No Reason"){
|
||||
$this->commandHandler("kick", array($username, $reason), "console", "");
|
||||
}
|
||||
@ -301,6 +339,11 @@ class BanAPI{
|
||||
$this->commandHandler("whitelist", array("reload"), "console", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ip
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isIPBanned($ip){
|
||||
if($this->server->api->dhandle("api.ban.ip.check", $ip) === false){
|
||||
return true;
|
||||
@ -310,6 +353,11 @@ class BanAPI{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBanned($username){
|
||||
$username = strtolower($username);
|
||||
if($this->server->api->dhandle("api.ban.check", $username) === false){
|
||||
@ -320,6 +368,11 @@ class BanAPI{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function inWhitelist($username){
|
||||
$username = strtolower($username);
|
||||
if($this->isOp($username)){
|
||||
|
@ -33,6 +33,14 @@ class ChatAPI{
|
||||
$this->server->api->ban->cmdWhitelist("me");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $cmd
|
||||
* @param array $params
|
||||
* @param string $issuer
|
||||
* @param string $alias
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function commandHandler($cmd, $params, $issuer, $alias){
|
||||
$output = "";
|
||||
switch($cmd){
|
||||
@ -88,14 +96,28 @@ class ChatAPI{
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
*/
|
||||
public function broadcast($message){
|
||||
$this->send(false, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $text
|
||||
* @param mixed $player Can be either Player object or string username. Boolean false for broadcast.
|
||||
*/
|
||||
public function sendTo($owner, $text, $player){
|
||||
$this->send($owner, $text, array($player));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $owner Can be either Player object or string username. Boolean false for broadcast.
|
||||
* @param string $text
|
||||
* @param $whitelist
|
||||
* @param $blacklist
|
||||
*/
|
||||
public function send($owner, $text, $whitelist = false, $blacklist = false){
|
||||
$message = array(
|
||||
"player" => $owner,
|
||||
|
@ -87,6 +87,12 @@ class Player{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $clientID
|
||||
* @param string $ip
|
||||
* @param integer $port
|
||||
* @param integer $MTU
|
||||
*/
|
||||
public function __construct($clientID, $ip, $port, $MTU){
|
||||
$this->bigCnt = 0;
|
||||
$this->MTU = $MTU;
|
||||
@ -114,6 +120,9 @@ class Player{
|
||||
return $this->spawnPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Vector3 $pos
|
||||
*/
|
||||
public function setSpawn(Vector3 $pos){
|
||||
if(!($pos instanceof Position)){
|
||||
$level = $this->level;
|
||||
@ -255,6 +264,10 @@ class Player{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $reason Reason for closing connection
|
||||
* @param boolean $msg Set to false to silently disconnect player. No broadcast.
|
||||
*/
|
||||
public function close($reason = "", $msg = true){
|
||||
if($this->connected === true){
|
||||
foreach($this->evid as $ev){
|
||||
@ -295,6 +308,11 @@ class Player{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Vector3 $pos
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function sleepOn(Vector3 $pos){
|
||||
foreach($this->server->api->player->getAll($this->level) as $p){
|
||||
if($p->isSleeping instanceof Vector3){
|
||||
@ -336,6 +354,13 @@ class Player{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
* @param $damage
|
||||
* @param $count
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasSpace($type, $damage, $count){
|
||||
$inv = $this->inventory;
|
||||
while($count > 0){
|
||||
@ -362,6 +387,14 @@ class Player{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
* @param $damage
|
||||
* @param integer $count
|
||||
* @param boolean $send
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function addItem($type, $damage, $count, $send = true){
|
||||
while($count > 0){
|
||||
$add = 0;
|
||||
@ -418,6 +451,13 @@ class Player{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $slot
|
||||
* @param Item $item
|
||||
* @param boolean $send
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function setSlot($slot, Item $item, $send = true){
|
||||
$this->inventory[(int) $slot] = $item;
|
||||
if($send === true){
|
||||
@ -426,6 +466,11 @@ class Player{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $slot
|
||||
*
|
||||
* @return Item
|
||||
*/
|
||||
public function getSlot($slot){
|
||||
if(isset($this->inventory[(int) $slot])){
|
||||
return $this->inventory[(int) $slot];
|
||||
@ -467,6 +512,11 @@ class Player{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $slot
|
||||
*
|
||||
* @return Item
|
||||
*/
|
||||
public function getArmor($slot){
|
||||
if(isset($this->armor[(int) $slot])){
|
||||
return $this->armor[(int) $slot];
|
||||
@ -484,6 +534,10 @@ class Player{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param string $event
|
||||
*/
|
||||
public function eventHandler($data, $event){
|
||||
switch($event){
|
||||
case "tile.update":
|
||||
|
Loading…
x
Reference in New Issue
Block a user