How do i make it so that...

Discussion in 'Plugin Development' started by vivabenfica4, Nov 18, 2013.

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

    vivabenfica4

    How do i make it so that this only works once by using if the player is on the ground without counting the material air of course.

    Code
    Code:java
    1. package com.hotmail.samuelman4;
    2.  
    3. import org.bukkit.Effect;
    4. import org.bukkit.Sound;
    5. import org.bukkit.entity.Player;
    6. import org.bukkit.event.EventHandler;
    7. import org.bukkit.event.Listener;
    8. import org.bukkit.event.player.PlayerMoveEvent;
    9. import org.bukkit.util.Vector;
    10.  
    11. public class PlayerLauncher implements Listener {
    12.  
    13. public PlayerLauncher(FlourecentCraft flourecentCraft) {
    14. }
    15.  
    16. @EventHandler
    17. public void onMove(PlayerMoveEvent event){
    18. Player player = event.getPlayer();
    19. Vector pdirection = player.getLocation().getDirection();
    20. if (player.isSneaking()) {
    21. if (event.getFrom().getY()<event.getTo().getY()){
    22. player.playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 5, 5);
    23. player.playEffect(player.getLocation(), Effect.MOBSPAWNER_FLAMES, null);
    24. player.setVelocity((pdirection.multiply(1)));
    25. player.setFallDistance(-500.0F);
    26. }
    27. }
    28. }
    29. }
     
  2. Offline

    bartboy8

    vivabenfica4
    Code:
    ArrayList<String> used = new ArrayList<String>();
     
     
    //add this line in when adding all the sounds and things
    used.add(player.getName());
     
     
    //insert this check
    if(!used.contains(player.getName())
    {
    //do things
    }
     
  3. Offline

    vivabenfica4


    yeh but how do i make it so that when he is on the ground it removes him from the array list, because player.isOnGround is saying it is deprecated.
     
  4. Offline

    bartboy8

    It's fine if its deprecated :)
     
  5. Offline

    vivabenfica4

    oh k
     
  6. Offline

    AoH_Ruthless

    vivabenfica4
    Suppress the warnings. As bart said, it doesn't make a difference.

    On a side note: I laughed when I saw your class name was PlayerLauncher
     
    Jake6177 likes this.
Thread Status:
Not open for further replies.

Share This Page