mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 17:29:44 +00:00
Updated RakLib, fixed help message not showing command, added documentation to Plugin->getResource()
This commit is contained in:
parent
9fac990b19
commit
24c6cca664
@ -683,7 +683,7 @@ class Server{
|
|||||||
$result = $this->getPlayerExact($name);
|
$result = $this->getPlayerExact($name);
|
||||||
|
|
||||||
if($result === null){
|
if($result === null){
|
||||||
return new OfflinePlayer($this, $name);
|
$result = new OfflinePlayer($this, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -87,11 +87,11 @@ class HelpCommand extends VanillaCommand{
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
if(($command = $sender->getServer()->getCommandMap()->getCommand(strtolower($command))) instanceof Command){
|
if(($cmd = $sender->getServer()->getCommandMap()->getCommand(strtolower($command))) instanceof Command){
|
||||||
if($command->testPermissionSilent($sender)){
|
if($cmd->testPermissionSilent($sender)){
|
||||||
$message = TextFormat::YELLOW . "--------- " . TextFormat::WHITE . " Help: /" . $command->getName() . TextFormat::YELLOW . " ---------\n";
|
$message = TextFormat::YELLOW . "--------- " . TextFormat::WHITE . " Help: /" . $cmd->getName() . TextFormat::YELLOW . " ---------\n";
|
||||||
$message .= TextFormat::GOLD . "Description: " . TextFormat::WHITE . $command->getDescription() . "\n";
|
$message .= TextFormat::GOLD . "Description: " . TextFormat::WHITE . $cmd->getDescription() . "\n";
|
||||||
$message .= TextFormat::GOLD . "Usage: " . TextFormat::WHITE . implode("\n" . TextFormat::WHITE, explode("\n", $command->getUsage())) . "\n";
|
$message .= TextFormat::GOLD . "Usage: " . TextFormat::WHITE . implode("\n" . TextFormat::WHITE, explode("\n", $cmd->getUsage())) . "\n";
|
||||||
$sender->sendMessage($message);
|
$sender->sendMessage($message);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -134,7 +134,7 @@ class RakLibInterface implements ServerInstance, SourceInterface{
|
|||||||
}else{
|
}else{
|
||||||
$info = $this->rakLib->getTerminationInfo();
|
$info = $this->rakLib->getTerminationInfo();
|
||||||
$this->server->removeInterface($this);
|
$this->server->removeInterface($this);
|
||||||
\ExceptionHandler::handler(E_ERROR, "RakLib Thread crashed [".$info["scope"]."]" . (isset($info["message"]) ? $info["message"] : ""), $info["file"], $info["line"]);
|
\ExceptionHandler::handler(E_ERROR, "RakLib Thread crashed [".$info["scope"]."]: " . (isset($info["message"]) ? $info["message"] : ""), $info["file"], $info["line"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +171,7 @@ abstract class PluginBase implements Plugin{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an embedded resource on the plugin file.
|
* Gets an embedded resource on the plugin file.
|
||||||
|
* WARNING: You must close the resource given using fclose()
|
||||||
*
|
*
|
||||||
* @param string $filename
|
* @param string $filename
|
||||||
*
|
*
|
||||||
|
@ -101,9 +101,7 @@ class AsyncPool{
|
|||||||
|
|
||||||
$task->onCompletion($this->server);
|
$task->onCompletion($this->server);
|
||||||
|
|
||||||
$this->workerUsage[$this->taskWorkers[$task->getTaskId()]]--;
|
$this->removeTask($task);
|
||||||
unset($this->tasks[$task->getTaskId()]);
|
|
||||||
unset($this->taskWorkers[$task->getTaskId()]);
|
|
||||||
}elseif($task->isTerminated()){
|
}elseif($task->isTerminated()){
|
||||||
$info = $task->getTerminationInfo();
|
$info = $task->getTerminationInfo();
|
||||||
$this->removeTask($task);
|
$this->removeTask($task);
|
||||||
|
@ -194,6 +194,9 @@ class MainLogger extends \AttachableThreadedLogger{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->logStream .= date("Y-m-d", $now) . " " . $cleanMessage;
|
$this->logStream .= date("Y-m-d", $now) . " " . $cleanMessage;
|
||||||
|
$this->synchronized(function(){
|
||||||
|
$this->notify();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run(){
|
public function run(){
|
||||||
@ -204,17 +207,21 @@ class MainLogger extends \AttachableThreadedLogger{
|
|||||||
}
|
}
|
||||||
|
|
||||||
while($this->shutdown === false){
|
while($this->shutdown === false){
|
||||||
if(strlen($this->logStream) >= 4096){
|
if($this->logStream !== ""){
|
||||||
|
$this->synchronized(function(){
|
||||||
$this->lock();
|
$this->lock();
|
||||||
$chunks = strlen($this->logStream) >> 12;
|
$chunk = $this->logStream;
|
||||||
$chunk = substr($this->logStream, 0, $chunks << 12);
|
$this->logStream = "";
|
||||||
$this->logStream = substr($this->logStream, $chunks << 12);
|
|
||||||
$this->unlock();
|
$this->unlock();
|
||||||
fwrite($this->logResource, $chunk);
|
fwrite($this->logResource, $chunk);
|
||||||
|
});
|
||||||
}else{
|
}else{
|
||||||
usleep(250000); //sleep for 0.25 seconds
|
$this->synchronized(function(){
|
||||||
|
$this->wait(250000);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen($this->logStream) > 0){
|
if(strlen($this->logStream) > 0){
|
||||||
fwrite($this->logResource, $this->logStream);
|
fwrite($this->logResource, $this->logStream);
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 2faa3d242c09aba253dc3f3e2a861e91906ac2f9
|
Subproject commit e33ec9852b6d4635ca3edb59951674ac1cefe0d4
|
Loading…
x
Reference in New Issue
Block a user