Created
May 6, 2014 21:07
-
-
Save geNAZt/60ecc7ba4c9be1d48336 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void moveBitch( final Location start, final ArrayList<Tile> tiles, final Callback<Void> callback ) { | |
final AtomicInteger curPos = new AtomicInteger( 0 ); | |
final Plugin plugin = this; | |
final Runnable moveRunnable = new Runnable() { | |
@Override | |
public void run() { | |
if (skeleton1 != null) { | |
int current = curPos.getAndAdd( 1 ); | |
if ( current >= tiles.size() ) { | |
Bukkit.getScheduler().scheduleSyncDelayedTask( plugin, new Runnable() { | |
@Override | |
public void run() { | |
callback.done( null ); | |
} | |
}, ((Double) ( Math.random() * (double) 60 )).intValue() ); | |
return; | |
} | |
Tile tile = tiles.get( current ); | |
Location location1 = tile.getLocation( start ).add( 0, 1, 0 ); | |
((CraftSkeleton) skeleton1).getHandle().setLocation( location1.getX(), location1.getY(), location1.getZ(), location1.getYaw(), location1.getPitch() ); | |
Bukkit.getScheduler().scheduleSyncDelayedTask( plugin, this, 5 ); | |
} | |
} | |
}; | |
Bukkit.getScheduler().scheduleSyncDelayedTask( this, moveRunnable, 5 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment