Solved Scheduler help, 10 seconds

Discussion in 'Spigot Plugin Development' started by Frealy1995, May 12, 2016.

  1. Code (Text):

    public static int message = 0;
        public void onChat(AsyncPlayerChatEvent event){
            if(event.getMessage().length() != 0){
                if(message > 100){
    A run every 10 seconds (Playerchatmessage run)

    • Funny Funny x 4
    • Optimistic Optimistic x 1
  2. What are you trying to do? Right now it'll just say "good" after 100 messages were sent. And we will not spoonfeed you code.
  3. MiniDigger


    no. we don't spoonfeed you here. Explain to us what you are trying to do and where you are stuck and we will help you.
    • Agree Agree x 2
  4. I dont post spam!! If you want to reset my post no problem! I just need help okey? Please code example.
    • Funny Funny x 3
  5. Did I ever say anything about posting spam? :p

    Again, we will not spoonfeed you code.
    • Agree Agree x 4
  6. Oh okey sorry! And please code please please
    • Optimistic Optimistic x 3
  7. This is easy example:

    You run one every 10 seconds

    Code (Text):

    public void sendMessage(Player player){
  8. MiniDigger


    do you even read what we are saying here? this is form the sticky thread:
    tell us what you are trying to do or leave.
    • Agree Agree x 1
    • Friendly Friendly x 1
  9. Use a Bukkit runnable and make a repeating task that goes every 200 ticks.
    • Agree Agree x 1
  10. MiniDigger


    you want to use the bukkit scheduler for that.
    Here is a guide in frensh for you:
  11. Okey I know and Im English very bad. Please code
    • Funny Funny x 1
    • Funny Funny x 1
  12. MiniDigger


    your profile said you were france, the guide is translated into many languages. Here is the english one, scroll to the button to select another one:
    and again: no code for you
  13. Thanks!

    I test a error

    Code (Text):

    public static void cpsTimer(){
            BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
            scheduler.scheduleSyncDelayedTask(this, new Runnable() {
                public void run() {
            }, 20L);
    Error line: (this, new Runnable

    error = this
  14. MiniDigger


    what does the error say?
    where is this method located? 'this' has to be a reference to your main class. if you don't put the method into your main class you need to pass over a reference
  15. THIS: is what u get when u click on his profile:
    Male, 21, from France

    • Agree Agree x 1
    • Funny Funny x 1
    • Friendly Friendly x 1
  16. And definitely not 21...
    • Agree Agree x 1
  17. make an instance of your main in replacement of 'this'
  18. Yes I dont 21 years old! okey? thanks.


    scheduler.scheduleSyncDelayedTask(this, new Runnable() {

    (this, new Runnable()

    Error: (this,
  19. MiniDigger


    Know your java before posting here please...
    • Agree Agree x 1