Plugin Help scheduleSyncRepeatingTask error

Discussion in 'Plugin Help/Development/Requests' started by haussik, Nov 29, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    haussik

    Here is the code with the error:

    Code:java
    1. package me.chargon.CParticles.Main;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.Effect;
    5. import org.bukkit.Location;
    6. import org.bukkit.command.Command;
    7. import org.bukkit.command.CommandExecutor;
    8. import org.bukkit.command.CommandSender;
    9. import org.bukkit.entity.Entity;
    10. import org.bukkit.entity.Player;
    11. import org.bukkit.plugin.Plugin;
    12.  
    13. import de.slikey.effectlib.EffectManager;
    14.  
    15. public class Particules implements CommandExecutor{
    16.  
    17. private static Main plugin;
    18. public Particules(Main plugin) {
    19. this.plugin = plugin;
    20. }
    21.  
    22. @Override
    23. public boolean onCommand(CommandSender sender, Command cmd, String label,String[] args) {
    24. if(cmd.getName().equalsIgnoreCase("cp")){
    25. if(args.length == 1){
    26. if(args[0].equalsIgnoreCase("feu")){
    27. Player player = (Player) sender;
    28. Location loc = player.getPlayer().getLocation();
    29.  
    30. // ERROR HERE Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
    31.  
    32. @Override
    33. public void run(){
    34.  
    35. player.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 10);
    36. }
    37. }, 0, 1 * 20);
    38.  
    39. }
    40. return true;
    41. }
    42. }else{
    43. return false;
    44. }
    45. return true;
    46. }
    47.  
    48. }
    49.  


    scheduleSyncRepeatingTask is red and the error say: is not applicable for the arguments (Particules, new Runnable()(), int, int)

    Please i don't know what to do ._.
     
  2. haussik
    Replace "this" with "plugin". The constructor of the method requires an instance of your main class, and you're trying to feed it something else.
     
  3. Offline

    haussik

    Assist ho yeah ^^ I don't understand why i didn't see it ! Thanks
     
Thread Status:
Not open for further replies.

Share This Page