Help In a Nuker Kit!

Discussion in 'Plugin Development' started by IceHower, May 24, 2014.

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

    IceHower

    How can I do that when the player is in the air by clicking again on TNT that he or faster than the nuker (pvpdojo) kit?

    My code:
    Code:java
    1. public int cooldown = 30;
    2. protected Map<String, Long> playerCooldownss = new HashMap<String, Long>();
    3. @EventHandler
    4. public void SubirNuker(PlayerInteractEvent event) {
    5. Player p = event.getPlayer();
    6. String playerName = p.getName();
    7. if (Main.nuker.contains(p.getName()))
    8. {
    9. if (!p.hasPermission("pvp.nuker")) {
    10. return;
    11. }
    12. if (!p.getItemInHand().getType().equals(Material.TNT))
    13. {
    14. return;
    15. }
    16. if (this.playerCooldownss.containsKey(playerName)) {
    17. long diff = (System.currentTimeMillis() - ((Long)this.playerCooldownss.get(playerName)).longValue()) / 1000L;
    18. if (diff < this.cooldown) {
    19. p.sendMessage(ChatColor.DARK_RED + "Voce So Pode Usa Depois De " + (this.cooldown - diff) + " Segundos!");
    20. return;
    21. }
    22. }
    23.  
    24. p.setVelocity(new Vector(1, 2, 0));
    25.  
    26. this.playerCooldownss.put(playerName, Long.valueOf(System.currentTimeMillis()));
    27. }
    28. }
    29. }

    Video kit:
     
  2. Offline

    EcMiner

    You should add him to a list when he clicks the item for the first time, indicating that he should be in the air, then when he clicks again check if he's in the list and if he's not on the ground and then launch him at the ground, hope this helps a little :)
     
  3. Offline

    CakePvP


    didnt u make the nuker kit??? LOL
     
    njb_said likes this.
  4. Offline

    EcMiner


    Maybe... xD
     
  5. Offline

    KylexDavis


    You're too kind! :D:D:D
     
  6. Offline

    njb_said

    nice copy of pvpdojo kit inspired by pvpdojo
     
  7. Offline

    Maximapple

    kit inspired by pvpdojo
     
  8. Offline

    IceHower

    EcMiner
    Sorry for wanting to do the kit and kit inspired by pvpdojo!

    I tried to do so but anyway not operate normally
    Code:
    Code:java
    1. public int cooldown = 30;
    2. @EventHandler
    3. public void SubirNuker(PlayerInteractEvent event) {
    4. final Player p = event.getPlayer();
    5. final String playerName = p.getName();
    6. if (Main.nuker.contains(p.getName()))
    7. {
    8. if (!p.hasPermission("pvp.nuker")) {
    9. return;
    10. }
    11. if (!p.getItemInHand().getType().equals(Material.TNT))
    12. {
    13. return;
    14. }
    15. if (this.playerCooldownss.containsKey(playerName)) {
    16. long diff = (System.currentTimeMillis() - ((Long)this.playerCooldownss.get(playerName)).longValue()) / 1000L;
    17. if (diff < this.cooldown) {
    18. p.sendMessage(ChatColor.DARK_RED + "Voce So Pode Usa Depois De " + (this.cooldown - diff) + " Segundos!");
    19. return;
    20. }
    21. }
    22. p.setVelocity(new Vector(1, 2, 0));
    23. Main.nukernoar.add(p.getName());
    24. }
    25. }
    26. protected Map<String, Long> playerCooldownss = new HashMap<String, Long>();
    27. @EventHandler
    28. public void DescerNuker(PlayerInteractEvent event) {
    29. final Player p = event.getPlayer();
    30. final String playerName = p.getName();
    31. if (Main.nukernoar.contains(p.getName()))
    32. {
    33. if (!p.hasPermission("pvp.nuker")) {
    34. return;
    35. }
    36. if (!p.getItemInHand().getType().equals(Material.TNT))
    37. {
    38. return;
    39. }
    40. }
    41. p.setVelocity(new Vector(0, -2, 0));
    42. Bukkit.getScheduler().scheduleSyncDelayedTask(plugin,
    43. new Runnable()
    44. {
    45. public void run()
    46. {
    47. Main.nukernoar.remove(p.getName());
    48. }
    49. }
    50. , 100L);
    51. playerCooldownss.put(playerName, Long.valueOf(System.currentTimeMillis()));
    52. }
    53. }

    Can someone help me?

    EcMiner Thanks for the tip!
     
  9. Offline

    EcMiner


    What exactly is not functioning correctly?
     
  10. Offline

    IceHower

    EcMiner
    Never mind, I already managed to make the kit! :)
    Thanks for the tip!

    This kit will stay in a private server where I play with my friends because pvpdojo for us and very laggy because we live on another continent
     
Thread Status:
Not open for further replies.

Share This Page