mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Added new exception when a plugin creates an orphaned PluginTask
This commit is contained in:
parent
81faddafb0
commit
e97139919a
@ -166,8 +166,12 @@ class ServerScheduler{
|
|||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
private function addTask(Task $task, $delay, $period){
|
private function addTask(Task $task, $delay, $period){
|
||||||
if($task instanceof PluginTask and !$task->getOwner()->isEnabled()){
|
if($task instanceof PluginTask){
|
||||||
throw new \Exception("Plugin attempted to register a task while disabled");
|
if(!($task->getOwner() instanceof Plugin)){
|
||||||
|
throw new \Exception("Invalid owner of PluginTask ".get_class($task));
|
||||||
|
}elseif(!$task->getOwner()->isEnabled()){
|
||||||
|
throw new \Exception("Plugin '".$task->getOwner()->getName()."' attempted to register a task while disabled");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($delay <= 0){
|
if($delay <= 0){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user