Advertisement
Guest User

Untitled

a guest
Aug 28th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.57 KB | None | 0 0
  1. public class PortalEffect {
  2.     public static void playEffectPacket(Player player) {
  3.         int x = (int) player.getLocation().getX();
  4.         int y = (int) player.getLocation().getY();
  5.         int z = (int) player.getLocation().getZ();
  6.  
  7.         PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(
  8.                 EnumParticle.PORTAL,    // particle type.
  9.                 true,                                                   // true
  10.                 x,             // x coordinate
  11.                 y,             // y coordinate
  12.                 z,             // z coordinate
  13.                 5,                                                              // x offset
  14.                 5,                                                              // y offset
  15.                 5,                                                              // z offset
  16.                 10,                                                             // speed
  17.                 10_000,                                                 // number of particles
  18.                 null
  19.         );
  20.         BukkitRunnable runnable = new BukkitRunnable() {
  21.             @Override
  22.             public void run() {
  23.                 ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
  24.             }
  25.         };
  26.         runnable.runTaskTimerAsynchronously(Main.getInstance(), 1L, 20L);
  27.         new EventUtil(Main.getInstance()) {
  28.             @EventHandler
  29.             public void onQuit(PlayerQuitEvent e) {
  30.                 runnable.cancel();
  31.             }
  32.         };
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement