ServerScheduler: remove nonsensical condition in addTask()

now that return type declarations exist, it's not possible for this to return a non-Plugin instance.
This commit is contained in:
Dylan K. Taylor 2018-05-29 18:17:49 +01:00
parent 0a50b8cb9b
commit 299e4c8a85

View File

@ -275,12 +275,8 @@ class ServerScheduler{
* @throws PluginException
*/
private function addTask(Task $task, int $delay, int $period){
if($task instanceof PluginTask){
if(!($task->getOwner() instanceof Plugin)){
throw new PluginException("Invalid owner of PluginTask " . get_class($task));
}elseif(!$task->getOwner()->isEnabled()){
throw new PluginException("Plugin '" . $task->getOwner()->getName() . "' attempted to register a task while disabled");
}
if($task instanceof PluginTask and !$task->getOwner()->isEnabled()){
throw new PluginException("Plugin '" . $task->getOwner()->getName() . "' attempted to register a task while disabled");
}
if($delay <= 0){