Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PortalEffect {
- public static void playEffectPacket(Player player) {
- int x = (int) player.getLocation().getX();
- int y = (int) player.getLocation().getY();
- int z = (int) player.getLocation().getZ();
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(
- EnumParticle.PORTAL, // particle type.
- true, // true
- x, // x coordinate
- y, // y coordinate
- z, // z coordinate
- 5, // x offset
- 5, // y offset
- 5, // z offset
- 10, // speed
- 10_000, // number of particles
- null
- );
- BukkitRunnable runnable = new BukkitRunnable() {
- @Override
- public void run() {
- ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
- }
- };
- runnable.runTaskTimerAsynchronously(Main.getInstance(), 1L, 20L);
- new EventUtil(Main.getInstance()) {
- @EventHandler
- public void onQuit(PlayerQuitEvent e) {
- runnable.cancel();
- }
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement