Async Scheduler

This commit is contained in:
MidnightTale 2023-04-11 16:00:33 +07:00
commit 8d03a0038d

View file

@ -41,16 +41,16 @@ public class Bbsdfia extends JavaPlugin implements Listener {
World world = Bukkit.getServer().getWorld("world"); World world = Bukkit.getServer().getWorld("world");
Location spawnLoc = new Location(world, 100, 50, 0); Location spawnLoc = new Location(world, 100, 50, 0);
*/ */
Bukkit.getScheduler().runTask(this, () -> { Bukkit.getAsyncScheduler().runNow(this, task -> {
FallingBlock dummy = loc2.getWorld().spawnFallingBlock(loc2, ((FallingBlock) entity).getBlockData()); FallingBlock dummy = loc2.getWorld().spawnFallingBlock(loc2, ((FallingBlock) entity).getBlockData());
Vector dummyVel = vel.clone(); Vector dummyVel = vel.clone();
dummyVel.setY(-dummyVel.getY()); dummyVel.setY(-dummyVel.getY());
dummyVel.multiply(new Vector(2, 2, 2)); // double the velocity dummyVel.multiply(new Vector(2, 2, 2)); // double the velocity
// add a constant downward velocity to simulate gravity // add a constant downward velocity to simulate gravity
dummyVel.add(new Vector(0, 0.3, 0)); dummyVel.add(new Vector(0, 0.3, 0));
dummy.setVelocity(dummyVel); dummy.setVelocity(dummyVel);
}); });
} }
} }