Adding sound to teleportation event

Discussion in 'Plugin Development' started by Beans, Aug 12, 2012.

Thread Status:
Not open for further replies.
  1. Offline


    i have been trying to add the Blaze_Shoot sound when a player teleports inside the teleport even, but i cannot figure this out for the life of me. Here is my event.

    public void onPlayerTeleport(PlayerTeleportEvent event) {
            final Player player = event.getPlayer();
            if(event.getCause() == TeleportCause.COMMAND) {
                if (player.hasPermission("NinjaTP.Smoke") && ninjas.containsKey(player.getName()) && ninjas.get(player.getName()))
                    for (int i = 0; i <= 20; i++){
                    player.getWorld().playEffect(player.getLocation(), Effect.SMOKE, 4, 16);
                    player.getWorld().playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 4, 16);
                            player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0, 50);
    player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0, 50);
    so all the other stuff works, like the smoke and the Ender signal, but the sound is not playing. can someone help me please?
  2. Offline


    Moved to plugin dev.
  3. Offline


    First guess without really diving into it:

    Do "null" instead of "0" in the 3rd parameter
  4. Offline


    Maybe play the effect 1 tick later, at the player's new location?
    You are 100% sure the code is being called? Put a log statement in there to be sure.
Thread Status:
Not open for further replies.

Share This Page