Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void playAnimation(ArmorStand armorStand) {
- armorStand.teleport(LOBBY_TO_KILLAGER.getEnterLocation());
- int delay = 1;
- int firstBlockWalked = 21;
- int secondBlockWalked = 51;
- int thirdBlockWalked = 30;
- int first = Bukkit.getScheduler().scheduleSyncRepeatingTask(lobby, () -> {
- armorStand.teleport(armorStand.getLocation().subtract(0, 0, 2));
- }, 0, delay);
- Bukkit.getScheduler().scheduleSyncDelayedTask(lobby, () -> {
- Bukkit.getScheduler().cancelTask(first);
- Location newLocation = new Location(armorStand.getLocation().getWorld()
- , armorStand.getLocation().getX(), armorStand.getLocation().getY(), armorStand.getLocation().getZ()
- , -90, armorStand.getLocation().getPitch());
- armorStand.teleport(newLocation);
- int second = Bukkit.getScheduler().scheduleSyncRepeatingTask(lobby, () -> {
- armorStand.teleport(armorStand.getLocation().add(2, 0, 0));
- }, 0, delay);
- Bukkit.getScheduler().scheduleSyncDelayedTask(lobby, () -> {
- Bukkit.getScheduler().cancelTask(second);
- Location newSecondLocation = new Location(armorStand.getLocation().getWorld()
- , armorStand.getLocation().getX(), armorStand.getLocation().getY(), armorStand.getLocation().getZ()
- , 180, armorStand.getLocation().getPitch());
- armorStand.teleport(newSecondLocation);
- int third = Bukkit.getScheduler().scheduleSyncRepeatingTask(lobby, () -> {
- armorStand.teleport(armorStand.getLocation().subtract(0, 0, 2));
- }, 0, delay);
- Bukkit.getScheduler().scheduleSyncDelayedTask(lobby, () -> {
- Bukkit.getScheduler().cancelTask(third);
- }, delay * (thirdBlockWalked / 2));
- }, delay * (secondBlockWalked / 2));
- }, delay * (firstBlockWalked / 2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement