mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +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);
|
||||
|
||||
if($result === null){
|
||||
return new OfflinePlayer($this, $name);
|
||||
$result = new OfflinePlayer($this, $name);
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
@ -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;
|
||||
|
@ -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"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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);
|
||||
|
@ -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){
|
||||
if($this->logStream !== ""){
|
||||
$this->synchronized(function(){
|
||||
$this->lock();
|
||||
$chunks = strlen($this->logStream) >> 12;
|
||||
$chunk = substr($this->logStream, 0, $chunks << 12);
|
||||
$this->logStream = substr($this->logStream, $chunks << 12);
|
||||
$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
|
Loading…
x
Reference in New Issue
Block a user