Plugin forever loops an error instead of a task

Discussion in 'Plugin Development' started by NugNugz, Aug 1, 2020.

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


    So the server works and I can play. but the plugin does not do what it's supposed to. I get the error:
    Here is my code:
    package destroyBlock;
    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.scheduler.BukkitRunnable;
    public class DestroyBlock extends JavaPlugin{
        Player p;
        public void onEnable() {
                new BukkitRunnable() {
                    public void run() {
                        int x = p.getLocation().getBlockX();
                        int y = p.getLocation().getBlockY() - 1;
                        int z = p.getLocation().getBlockZ();
                        Location loc = new Location(p.getWorld(), x, y, z);
                }.runTaskTimerAsynchronously(this, 0, 20);
    I know the code works, I tested it to destroy a block every time I moved and it worked. I'm trying to just have it run every second without an event but it won't work. Any suggestions?
  2. Online

    timtower Moderator Moderator

    @NugNugz runTaskTimerAsynchronously should not be async
    And p is null
Thread Status:
Not open for further replies.

Share This Page