Insert Delay Effect (URGENT).

Discussion in 'Plugin Development' started by ToPoEdiTs, Aug 23, 2014.

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

    ToPoEdiTs

    as I can insert a time delay to the effect of double jump, and a message tells you that you have to wait (time) to use?
    Thanks.
    Code:

    Code:java
    1. @EventHandler
    2. public void onPlayerToggleFlight(PlayerToggleFlightEvent event) {
    3. Player player = event.getPlayer();
    4. String playerName = player.getName();
    5. PlayerMeta meta = PlayerMeta.getMeta(player);
    6. Kit kit = meta.getKit();
    7. if (kit == Kit.ACROBAT){
    8. if (player.getGameMode() == GameMode.CREATIVE)
    9. return;
    10. event.setCancelled(true);
    11. player.setAllowFlight(false);
    12. player.setFlying(false);
    13. player.playSound(player.getLocation(), Sound.GHAST_MOAN, 1, 1);
    14. player.setVelocity(player.getLocation().getDirection()
    15. .multiply(1.5).setY(1));
    16. }
    17. }
    18. @EventHandler
    19. public void onPlayerMove(PlayerMoveEvent event) {
    20. Player player = event.getPlayer();
    21. String playerName = player.getName();
    22. PlayerMeta meta = PlayerMeta.getMeta(player);
    23. Kit kit = meta.getKit();
    24. if (kit == Kit.ACROBAT){
    25. if ((player.getGameMode() != GameMode.CREATIVE)
    26.  
    27. && (player.getLocation().subtract(0, 1, 0).getBlock().getType() != Material.AIR)
    28.  
    29. && (!player.isFlying()))
    30. player.setAllowFlight(true);
    31.  
    32. }
    33. }
     
  2. Offline

    mine-care

    Put player in a arraylist and start a delayed task and remove him after xxx ticks (1 sec =20 ticks)

    If the arraylist contains the player send him the message that they have to wait else let them double jump
     
  3. Offline

    Dubehh

    mine-care
    UUID*
    And someone told me a HashSet is faster ;)
    But it's the same principe :)
     
  4. Offline

    reider45


    Just wondering, why is it better to use a UUID if you're just temporarily storing a name for a few seconds?
     
Thread Status:
Not open for further replies.

Share This Page