Before you type anything yes i get it you shouldn't be using it but i am just curious what it [is] does(even tho it no longer exist), what is the [replacement] alternative for it I assume just use scheduler and the type you want with new ClassName($param) and why it is removed(curious about it)?
I have not used CallbackTask myself, but callback is a parameter passed into a method, and the method will eventually call the callback method (or in this case, class) you passed in. I believe today there is a onComplete() method in standard tasks, which removes the purpose of providing a CallbackTask when you can run what you need inside the onComplete() method, which serves the same purpose.
Might or might not be true, but how does that answer his question? But, I would say the same as @HotFireyDeath. Haven't used them ever, though.
I think it simply got replaced with DelayedTask and or scheudledTask during some early versions of the new API or even got removed while converting from old api to new api
CallbackTask extends Task. scheduleDelayedTask and scheduleRepeatingTask are methods, not tasks. CallbackTask was first introduced here, but it never got widely used. There is no relationship between a CallbackTask and the AsyncTask::onCompletion() method.
You can simply use a RepeatingTask calling the method. PHP: public function onRun($currentTick) { $this->classInstance->tick();}
The concept of a RepeatingTask doesn't exist. It can be a repeating Task, but "RepeatingTask" used as one word shows that you have incorrect understanding on the scheduler system.
Every single post you've made on this forum shows you have no understanding of PocketMine or how it works. A call back task quite literally 'calls back'. When you initiate a call back task it requires you to define a callable function along with its class that is called upon execution. Basically using a callback task is bad practise now days cus #BlameShogi. We could either repeat the same task over again with a repeating task or continue to schedule delayed tasks to achieve the same result.
Yes, I know what a callable is. And you don't need to define a callable function along with its class. These are all callables: PHP: assert(is_callable("strlen"));assert(is_callable("Phar::running"));assert(is_callable(["Phar", "running"]));assert(is_callable([new ReflectionClass("Phar"), "getShortName"]));assert(is_callable(function(){ echo "I am a closure"; })); (This is PHP knowledge btw) Yet, a Task is a Task. A CallbackTask is also a Task. A Task is essentially like the java.lang.Runnable interface in Java (fine, it is an abstract class, and with other virtual methods such as onCancel() and actual methods like getTaskId(), happy now?), except that it also manages a TaskHandler. In my post above, I mentioned that there doesn't exist something in PocketMine called "RepeatingTask", only a scheduleRepeatingTask function. If you say "RepeatingTask", it implies that there exist something called RepeatingTask, while there doesn't. You can schedule a task and make it repeat, but from the PocketMine scheduler's perspective, a (delayed-) repeating task and a delayed task have no difference, as they are both tasks. Actually, the Task itself doesn't even directly store information about whether it is delayed or repeating. You can say that you can schedule a repeating task, but by saying "use a RepeatingTask", it sounds like there is actually something called RepeatingTask. There may be partial error in some of my posts, but if you think that every post that I make is wrong, please, I urge you to point out your evidence rather than meaninglessly claiming that it is ignorant. I may be a new member on the forums, but that doesn't mean that you can discriminate me as a noob on understanding PocketMine.
I recall that PEMapModder once saying that it's better not to know about CallBackTask at all... Can't find that post though.
I don't agree that CallbackTask is that evil. If you work with PocketMine core code, it is actually useful if you want to test something fast. Also, you could create a PluginCallbackTask yourself, such as https://github.com/PocketMine/PocketMine-MP/pull/2943 PHP 7 introduces anonymous classes. You can now schedule a delayed task like this: PHP: assert($plugin instanceof \pocketmine\plugin\Plugin);$plugin->scheduleDelayedTask(new class($plugin) extends PluginTask{ public function onRun($ticks){ // code }}, 1);
'Implying'. 'Understanding'. If I were to make a class that extends PocketMine's Task class I would probably write the task to either be repeated or delayed, this is why us humans of higher knowledge refer to tasks as either 'delayed tasks' or 'repeating tasks'. My point is that you're most likely going to be writing a task that is either going to be 'run' with a delay or the same instance will be 'run' repeatedly as it's very rare a task is made to be both delayed and repeated. PocketMine's task scheduler runs on a time based system, it records the next tick a task should be 'run' and 'runs' it whenever that next tick becomes the present tick.
What? Delaying a task or repeating a task is an action. When a task is scheduled to be repeated, it is a repeating task from plugin's perspective. If a task is scheduled to be delayed, it is a delayed task from plugin's perspective. But if you put "DelayedTask" as one word, it implies that there exists a term, or more frequently in object-oriented programmers' practice, a type name, called "DelayedTask". And there is no such type or term called DelayedTask in PocketMine. A delayed task can be scheduled as a repeating task anytime, and a repeating task can be cancelled anytime and scheduled as a delayed task anytime. If it were a type name, you can't "change" its type. Also, scheduling tasks is one of the most fundamental elements in PocketMine plugin development. Even though I am very new, at least I know that scheduling tasks is just one level above the basic plugin.yml and PluginBase stuff. Commands, events and scheduling tasks are the three elements of plugin triggering. Without them, a plugin is basically useless. (Two exceptions I can think of: 1) a plugin that merely does something on enable or disable, such as triggering a webhook to notify that the server is started/stopped; 2) a thread-based plugin like Volt by @Falk). It is certainly not something that only "humans of higher knowledge" would refer to. Instead, "humans of higher knowledge" should treat the myriad things in programming the same. A programmer of advanced knowledge about computer science can treat a certain memory byte from another process and manipulate it the same way as a certain memory byte from their own process (this is called hacking). Even if we humans of lower knowledge, at least we should treat instances of the same type the same, much less the same instance. We don't need to be a sage in programming to regard the same instance to be the same thing. Also note, a very high level of programming is that the level of understanding of data such that every memory byte, every memory unit, every file can be regarded as straw dogs (hacking), and the same memory unit can be treated as everything from a byte, an integer, a string, to an IP address. (the simple concept of a union in C/C++) This is also similar to this extract: Acting is not acting. By not acting you act. https://github.com/search?q=pocketmine scheduleDelayedRepeatingTask&type=Code I know that you won't be satisfied with this answer, as it is actually a repeating task that starts repeating at a delayed time. But as explained above, there is no problem and very reasonable if a repeating task gets cancelled and a delayed task of 1-tick delay No. It is not time-based. It is server-tick-based. Server ticking is based on a TPS-based process sleeping loop. Difference between time-based and server-tick-based: Time-based: As long as the server has enough load, a per-second task is run three times in three seconds. If we look at them as musical notes, normally it should have been three crotchets, but you may end up having a minim, then two quavers. Server-tick-based: If there is lag in the first second, even though there is plenty of server load to execute the tick again in the second and third seconds, the per-second task will only be run with the minimum interval of one second. That is, in terms of musical notes, it is one minim, then two crotchets, exceeding the three-times limit of the bar while the server has enough CPU to execute the third time within the three-times bar.
Also, scheduling tasks is one of the most fundamental elements in PocketMine plugin development. Even though I am very new, at least I know that scheduling tasks is just one level above the basic plugin.yml and PluginBase stuff. Commands, events and scheduling tasks are the three elements of plugin triggering. Without them, a plugin is basically useless. (Two exceptions I can think of: 1) a plugin that merely does something on enable or disable, such as triggering a webhook to notify that the server is started/stopped; 2) a thread-based plugin like Volt by @@Falk). It is certainly not something that only "humans of higher knowledge" would refer to. Instead, "humans of higher knowledge" should treat the myriad things in programming the same. A programmer of advanced knowledge about computer science can treat a certain memory byte from another process and manipulate it the same way as a certain memory byte from their own process (this is called hacking). Even if we humans of lower knowledge, at least we should treat instances of the same type the same, much less the same instance. We don't need to be a sage in programming to regard the same instance to be the same thing. --->Scheduling tasks is not the base of a plugin. The most plugins are listeners, wich are mostly more lightweight, although i do not use player moveevent (always scheduled task for that) But even my SSS(SignServerStats) wich has a thread, is using a repeating task to start the thread (And no, I'm not dumb I'm checking if the thread has finished)
The only trouble about creating a task is that you need to make another task. I mentioned it is "elementary" as "level 2", where the word "level" is a level-upon-level system. For example, the Minecraft PE protocol is (was) built upon the RakNet protocol layer , and the RakNet protocol level is built upon the UDP level, and the UDP level is built upon the IP level, and IP upon the Ethernet level. Level upon level, that is how programming works. Here is a hierarchy of my understanding of the levels of understanding of plugin development: Creating a dummy plugin Commands, event listeners, scheduling tasks. These are the three basic things that you need to understand so as to actually make a plugin work, and you can learn any one of them without knowing the other two. Optimized use of API functions, rather than stupidly asking the machine to do things again and again Proper usage of threading in PocketMine for optimization Identifying inter-plugin dependencies and clashes. Resolving the problems identified in 5. Resolving is much harder than identifying. PHP knowledge does not depend on the understanding of PocketMine plugin development.