mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-31 07:21:17 +00:00
A better error message for Server::getInstance() access on other threads
This commit is contained in:
parent
20d2ef9d38
commit
34d2047ac3
@ -1407,6 +1407,9 @@ class Server{
|
|||||||
* @return Server
|
* @return Server
|
||||||
*/
|
*/
|
||||||
public static function getInstance() : Server{
|
public static function getInstance() : Server{
|
||||||
|
if(self::$instance === null){
|
||||||
|
throw new \RuntimeException("Attempt to retrieve Server instance outside server thread");
|
||||||
|
}
|
||||||
return self::$instance;
|
return self::$instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user