Created
January 23, 2021 00:43
-
-
Save OskarZyg/1d3373bd86ff9d34f11e505b8cd0c3aa to your computer and use it in GitHub Desktop.
Revisions
-
OskarZyg created this gist
Jan 23, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ # BukkitRepeatingTask RepeatingTask Class that is useful for managing bukkit repeatingTasks > I didn't make this, I just cant find OC. # Usage: ```java RepeatingTask repeatingTask = new RepeatingTask(this, 0, 20) { @Override public void run() { cancelLoop(); } } ``` This will run a loop and cancel it. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; public abstract class RepeatingTask implements Runnable { private int taskId; public RepeatingTask(JavaPlugin plugin, int arg1, int arg2) { this.taskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, this, (long)arg1, (long)arg2); } public void cancelLoop() { Bukkit.getScheduler().cancelTask(this.taskId); } }