Updated RakLib, fixed help message not showing command, added documentation to Plugin->getResource()

This commit is contained in:
Shoghi Cervantes 2015-01-14 17:23:16 +01:00
parent 9fac990b19
commit 24c6cca664
No known key found for this signature in database
GPG Key ID: 78464DB0A7837F89
7 changed files with 25 additions and 19 deletions

View File

@ -683,7 +683,7 @@ class Server{
$result = $this->getPlayerExact($name);
if($result === null){
return new OfflinePlayer($this, $name);
$result = new OfflinePlayer($this, $name);
}
return $result;

View File

@ -87,11 +87,11 @@ class HelpCommand extends VanillaCommand{
return true;
}else{
if(($command = $sender->getServer()->getCommandMap()->getCommand(strtolower($command))) instanceof Command){
if($command->testPermissionSilent($sender)){
$message = TextFormat::YELLOW . "--------- " . TextFormat::WHITE . " Help: /" . $command->getName() . TextFormat::YELLOW . " ---------\n";
$message .= TextFormat::GOLD . "Description: " . TextFormat::WHITE . $command->getDescription() . "\n";
$message .= TextFormat::GOLD . "Usage: " . TextFormat::WHITE . implode("\n" . TextFormat::WHITE, explode("\n", $command->getUsage())) . "\n";
if(($cmd = $sender->getServer()->getCommandMap()->getCommand(strtolower($command))) instanceof Command){
if($cmd->testPermissionSilent($sender)){
$message = TextFormat::YELLOW . "--------- " . TextFormat::WHITE . " Help: /" . $cmd->getName() . TextFormat::YELLOW . " ---------\n";
$message .= TextFormat::GOLD . "Description: " . TextFormat::WHITE . $cmd->getDescription() . "\n";
$message .= TextFormat::GOLD . "Usage: " . TextFormat::WHITE . implode("\n" . TextFormat::WHITE, explode("\n", $cmd->getUsage())) . "\n";
$sender->sendMessage($message);
return true;

View File

@ -134,7 +134,7 @@ class RakLibInterface implements ServerInstance, SourceInterface{
}else{
$info = $this->rakLib->getTerminationInfo();
$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"]);
}
}

View File

@ -171,6 +171,7 @@ abstract class PluginBase implements Plugin{
/**
* Gets an embedded resource on the plugin file.
* WARNING: You must close the resource given using fclose()
*
* @param string $filename
*

View File

@ -101,9 +101,7 @@ class AsyncPool{
$task->onCompletion($this->server);
$this->workerUsage[$this->taskWorkers[$task->getTaskId()]]--;
unset($this->tasks[$task->getTaskId()]);
unset($this->taskWorkers[$task->getTaskId()]);
$this->removeTask($task);
}elseif($task->isTerminated()){
$info = $task->getTerminationInfo();
$this->removeTask($task);

View File

@ -194,6 +194,9 @@ class MainLogger extends \AttachableThreadedLogger{
}
$this->logStream .= date("Y-m-d", $now) . " " . $cleanMessage;
$this->synchronized(function(){
$this->notify();
});
}
public function run(){
@ -204,17 +207,21 @@ class MainLogger extends \AttachableThreadedLogger{
}
while($this->shutdown === false){
if(strlen($this->logStream) >= 4096){
$this->lock();
$chunks = strlen($this->logStream) >> 12;
$chunk = substr($this->logStream, 0, $chunks << 12);
$this->logStream = substr($this->logStream, $chunks << 12);
$this->unlock();
fwrite($this->logResource, $chunk);
if($this->logStream !== ""){
$this->synchronized(function(){
$this->lock();
$chunk = $this->logStream;
$this->logStream = "";
$this->unlock();
fwrite($this->logResource, $chunk);
});
}else{
usleep(250000); //sleep for 0.25 seconds
$this->synchronized(function(){
$this->wait(250000);
});
}
}
if(strlen($this->logStream) > 0){
fwrite($this->logResource, $this->logStream);
}

@ -1 +1 @@
Subproject commit 2faa3d242c09aba253dc3f3e2a861e91906ac2f9
Subproject commit e33ec9852b6d4635ca3edb59951674ac1cefe0d4