Repeating task

Discussion in 'BungeeCord Plugin Development' started by kukubaczek, May 25, 2015.

  1. Hi!
    I want to create a repeating task to refresh the header tablist of 1.8 player's.

    My code:
    Main (onEnable)
    Code (Text):
    ProxyServer.getInstance().getScheduler().runAsync(this, new TaskRepeating());
    TaskRepeating:
    Code (Text):
    package com.gmail.kukubaczek.bungee.tasks;

    import net.md_5.bungee.api.ProxyServer;
    import net.md_5.bungee.api.connection.ProxiedPlayer;

    import com.gmail.kukubaczek.bungee.Main;

    public class TaskRepeating implements Runnable {

        public void run() {
           
            for(ProxiedPlayer p : ProxyServer.getInstance().getPlayers()){
                p.sendMessage("1.8");
            }
           
        }

    }
    How to repeat the task every 5 seconds?
     
  2. konsolas

    Supporter

    Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
    @Override
    public void run() {
    // task here
    }
    }, 100, 100);
     
  3. I want to do that in BungeeCord.
     
  4. 1# Predictive code and javadocs are great; use them.
    2# General java knowledge would help
    3# Wait 24 hours before bumping