I am in the process of creating a spigot plugin (using Java and Bukkit language) that will allow me to store the coordinates of players in minecraft (Java edition) in real time.
I want to use a 'scheduler' to do this with a 'repeating task' structure.
I have the following code:
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask((Plugin)this, (Runnable)new Runnable() {
@Override
public void run() {
if (main.this.stopRepeater) {
main.this.logToFile(thePlayer, thePlayer.getLocation());
}
}
}, 0L, 20L);
}
However, I am not 100% sure what role the '@Override' and 'new Runnable()' parts of the code are actually playing here. This is the first time I'm using Java/Bukkit/Spigot for a project.
I am aware that 'new Runnable()' is used to create a new runnable thread of code, and that '@Override' method is used to override the parent class - but what is the 'parent class' in this case above?
I haven't been able to find a clear explanation for this as different sites say different things.
I would be so grateful if somebody could clarify this for me!