[Solved] Error Help

Discussion in 'Spigot Plugin Development' started by dyenxunit, May 20, 2015.

  1. I need some help i keep getting an error and idk whats going on can someone please help. I think this is whats causing the errors "Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {", but i dont know how to fix it.

    Code (Text):
    Error:404 Error not found

    Code (Text):
    public class Main extends JavaPlugin implements Listener{

    private static Main plugin;
    @Override
        public void onEnable(){
            //CoolDown
            Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
           
                @Override
                public void run() {
                    cooldown.handleCooldowns();
                }
            }, 1L, 1L);
    }
     
    #1 dyenxunit, May 20, 2015
    Last edited: May 20, 2015
  2. Your plugin variable is null, as shown by this text:

    EDIT: If you're trying to create a listener while in the main class, just use this instead.
     
  3. so i would make it like this Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
     
  4. Yes, if you're creating the scheduler inside of the main class. Just a side note, you may want to learn the basics of Java first before starting on a Spigot/Bukkit plugin. It'll give you a better understanding when you do decide to come back.
     
  5. tyvm it works now :) and yea i know that i should learn a bit of java before i jump into coding.
     
  6. You're welcome. If not for anything else, it'll make understanding what you're programming easier. Good luck on your development endeavor.
     
    • Like Like x 1