A delayed task within a Runnable help!?

Discussion in 'Plugin Development' started by unforgiven5232, May 25, 2013.

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

    unforgiven5232

    So im stuck with this error when i try to make a delayed task occur when the runnable is also happening, Thanks in advance
    Code:
    public int five = 5;
    final Main plugin = this;
    @Override
    public void run() {
     
    final Location loc = new Location(Bukkit.getWorld("world"), 943.0D, 13.0D, 1038.0D);
     
     
     
     
    final World world = loc.getWorld();
     
    Zombie zombie = world.spawn(loc, Zombie.class);
    ControllableMob<Zombie> controlledZombie = ControllableMobs.assign(zombie, true);
          zombie.setCustomName("Blue minon");
          zombie.setCustomNameVisible(true);
    controlledZombie.getActions().moveTo(new Location(Bukkit.getWorld("world"), 872, 12, 1113), true);
     
     
    plugin.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
    public void run(){
    Zombie follow = world.spawn(loc, Zombie.class);
    ControllableMob<Zombie> controlledZombie = ControllableMobs.assign(follow, true);
    controlledZombie.getActions().moveTo(new Location(Bukkit.getWorld("world"), 872, 12, 1113), true);
    }
     
     
    }, 80);
     
     
     
     
     
     
       
         
     
         
    }
     
  2. Offline

    Timatooth

    What is this error?
    Plus indentation and code fragments are kinda confusing, looks like you're scheduling a runnable inside its own run method. Can you paste the whole class using pastie?
     
  3. Offline

    unforgiven5232

    Timatooth
    I didnt really think it through about the second run method, but what i want is to put a delayed task within the runnable, and also that was my whole class :S.
     
Thread Status:
Not open for further replies.

Share This Page