how do i loop an if statement on a timer in java? [closed]
A quick search should lead you to this: https://bukkit.org/threads/creating-a-loop.119088/ https://www.codegrepper.com/code-examples/java/bukkit+repeating+task+every+minute+spigot
The code, without testing it:
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
Bukkit.broadcastMessage("This message is shown immediately and then repeated every second");
}
}, 0L, 20L); //0 Tick initial delay, 20 Tick (1 Second) between repeats
It seems like in Minecraft, 20 Ticks equals to one second. So you should calculate 20 x 60 x 5 to get the amount of ticks needed for 5 minutes.
Try 6000.
I also recommend to you to read the Javadoc of the Bukkit project.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/scheduler/BukkitScheduler.html#scheduleSyncRepeatingTask(org.bukkit.plugin.Plugin,org.bukkit.scheduler.BukkitRunnable,long,long)
This should lead you to the current function that is used.