GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
CallbackTask Class Reference

Public Member Functions

 __construct (callable $callable, array $args=[])
 
 getCallable ()
 
 onRun ($currentTicks)
 
- Public Member Functions inherited from Task
 getHandler ()
 
 getTaskId ()
 
 setHandler ($taskHandler)
 
 onRun ($currentTick)
 
 onCancel ()
 

Protected Attributes

 $callable
 
 $args
 

Detailed Description

Allows the creation of simple callbacks with extra data The last parameter in the callback will be this object

If you want to do a task in a Plugin, consider extending PluginTask to your needs

Deprecated:
Do NOT use this anymore, it was deprecated a long time ago at PocketMine and will be removed at some stage in the future.

Constructor & Destructor Documentation

◆ __construct()

__construct ( callable  $callable,
array  $args = [] 
)
Parameters
callable$callable
array$args
47  {
48  $this->callable = $callable;
49  $this->args = $args;
50  $this->args[] = $this;
51  }

Member Function Documentation

◆ getCallable()

getCallable ( )
Returns
callable
56  {
57  return $this->callable;
58  }

◆ onRun()

onRun (   $currentTicks)
Parameters
$currentTicks
63  {
64  call_user_func_array($this->callable, $this->args);
65  }

Field Documentation

◆ $args

$args
protected

◆ $callable

$callable
protected

The documentation for this class was generated from the following file: