Improve a Bukkit Runnable

Status
This thread has been locked.

rightfootmessi

Feedback score
0
Posts
35
Reactions
7
Resources
0
A plugin I've created uses a BukkitRunnable .runTaskLater(Plugin plugin, long delay) to run a series of methods after a time specified by the user. The problem is, I would like to be able to modify the delay time while it's counting down but this is not possible solely by using BukkitRunnables. I was advised by a user on Spigot forums to create my own "repeating task system" as he called it. However, since I'm not experienced with Java I have hardly a clue how to go about this, aside from this hint he left me:

I use my own repeating task system in my plugins to solve this and a few other shortcomings of the BukkitRunnable (and by extension Runnable in general), it is fairly easy to implement a task that has a variable delay, simply check if the number of ticks % delay == 0, if so, run the task.

I'm not asking to be spoonfed code, so unless you want to do that please just walk me through how to accomplish this.

(On a side note, if anyone could recommend some good books/online courses to learn Java with that would be much appreciated).
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Christopher

Floating around
Supreme
Feedback score
8
Posts
2,048
Reactions
1,120
Resources
0
A plugin I've created uses a BukkitRunnable .runTaskLater(Plugin plugin, long delay) to run a series of methods after a time specified by the user. The problem is, I would like to be able to modify the delay time while it's counting down but this is not possible solely by using BukkitRunnables. I was advised by a user on Spigot forums to create my own "repeating task system" as he called it. However, since I'm not experienced with Java I have hardly a clue how to go about this, aside from this hint he left me:



I'm not asking to be spoonfed code, so unless you want to do that please just walk me through how to accomplish this.

(On a side note, if anyone could recommend some good books/online courses to learn Java with that would be much appreciated).
If you have $$$, then Samuel can help you. Or maybe try @Minescript
 

Christopher

Floating around
Supreme
Feedback score
8
Posts
2,048
Reactions
1,120
Resources
0
I have no spending money, unfortunately. If I did it would already have been invested in my server. Also, the second mention doesn't link to anybody...
Fair enough, and I noticed that, looking for their name now :p
 
Status
This thread has been locked.
Top