Solved Weird stuff happening with BukkitRunnables pls help

Discussion in 'Plugin Development' started by xpaintall, Feb 19, 2021.

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

    xpaintall

    Ok, I am posting another thread, it is just because BukkitRunnables stopped working. I am making a plugin that detects every second if your Y coordinate is under something like 30 or so. Now I made a sepereate class (not extending BukkitRunnable) and when I do
    Code:
    new BukkitRunnable {
            @Override
             public void run() {
               //methods
            }
        } 
    It doesn't work. The code turn all red and stuff. Now I basically copied and pasted code from a previous class and pasted it in another class (they did not implement anything and I am confused why is this happening).
    The code was the same, I just deleted the other class coz the name had a typo in it and I do not like seeing typos.
    Pls help
     
  2. Online

    timtower Administrator Administrator Moderator

  3. Offline

    xpaintall

    Code:
    package com.xpaintall.TutorialMain.BridgeChallenge;
    
    import com.xpaintall.TutorialMain.TutMain;
    import org.bukkit.Bukkit;
    import org.bukkit.Location;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerEvent;
    import org.bukkit.scheduler.BukkitRunnable;
    
    public class detectingylevel implements Listener {
    
    
    
        TutMain plugin;
         detectingylevel(TutMain plugin) {
             this.plugin = plugin;
         }
    
             new BukkitRunnable() {
                 @Override
                 public void run() {
                     Bukkit.broadcastMessage("something");
                 }
    
    
             }.runTaskTimer(plugin, 0, 1*20);
    
    }
    
     
  4. Online

    timtower Administrator Administrator Moderator

    @xpaintall You do realize that it is outside the method right?
     
  5. Offline

    xpaintall

    Yes @timtower , I realized and that's why I marked it as solved. Thanks for your time.
     
Thread Status:
Not open for further replies.

Share This Page