Shift Right Click jump.

Discussion in 'Plugin Development' started by PlayerNerd, Sep 9, 2014.

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

    PlayerNerd

    I made a event that when the player is with sneak and right click, change the item in his hand, but it jump the item i go to de last item (Are various changes). How can i fix it?
     
    ChipDev likes this.
  2. Offline

    ChipDev

    Just because you joined the day after my b-day, heres your first like ;)
    And rename the title, Or edit your post, your asking for 2 things.
     
  3. Offline

    Cerberus XII

    PlayerNerd,
    Sorry but i can't interpret what you are asking for? Maybe if English is not your first language use Google Translate.
     
  4. Offline

    PlayerNerd

    Cerberus XII i wanna know how can i use shift right click in mutiple things.
     
  5. Offline

    JBoss925

    Please use google translate, I can't understand what you are saying.
     
  6. Offline

    PlayerNerd

    JBoss925 How can i use isSneaking with multiple RIGHT_CLICK_AIR
     
  7. Offline

    JBoss925

    isSneaking() is a player method, use it as much as you want.
     
  8. Offline

    Minesuchtiiii

    I don't understand what you want. You want that when a player sneeks and right clicks an item the item changes to another item? Sorry, I really don't understand what you want...
     
  9. Offline

    PlayerNerd

    JBoss925 I know but, when i use it with mutiple RIGHT_CLICK_AIR the right_click is jump and it go to the last right_click.
     
  10. Offline

    Unica

    PlayerNerd

    Code:java
    1. @EventHandler
    2. public void onInteract(PlayerInteractEvent e){
    3. if(e.getAction.equals(Action.RIGHT_CLICK_AIR) && p.isSneaking()){
    4. doSomething();
    5. }
    6.  
    7.  
    8. }
     
  11. Offline

    PlayerNerd

    Unica If i put like 3 right click air, it jumps the first and second and go to de last. I wanna fix it
     
  12. Offline

    werter318

    PlayerNerd Maybe because the first 2 conditions are not true?
     
  13. Offline

    Unica

    PlayerNerd

    show your code, and tell me again what you mean.
     
  14. Offline

    PlayerNerd

    Unica
    Code:java
    1.  
    2.  
    3. @EventHandler
    4. public void onMago(PlayerInteractEvent e)
    5. {
    6. final Player p = e.getPlayer();
    7.  
    8. ItemStack wandmag = Kit.createItem(Material.DIAMOND_HOE, ChatColor.DARK_RED + "[" + ChatColor.GOLD + "#PiáTem" + ChatColor.DARK_RED + "] " + ChatColor.AQUA + "Varinha Mágica", "Shift Direito para escolher habilidades!");
    9. ItemStack wandmag1 = Kit.createItem(Material.DIAMOND_HOE, ChatColor.DARK_RED + "[" + ChatColor.GOLD + "#PiáTem" + ChatColor.DARK_RED + "] " + ChatColor.AQUA + "Varinha Mágica " + ChatColor.GRAY + "(" + ChatColor.GREEN + "Teleporte" + ChatColor.GRAY + ")", ChatColor.RED + "Clique com direito e teleporte para o jogador!");
    10. ItemStack wandmag2 = Kit.createItem(Material.DIAMOND_HOE, ChatColor.DARK_RED + "[" + ChatColor.GOLD + "#PiáTem" + ChatColor.DARK_RED + "] " + ChatColor.AQUA + "Varinha Mágica " + ChatColor.GRAY + "(" + ChatColor.GREEN + "Empurro Divino" + ChatColor.GRAY + ")", ChatColor.RED + "Seja empurrado por uma força do além!");
    11. ItemStack wandmag3 = Kit.createItem(Material.DIAMOND_HOE, ChatColor.DARK_RED + "[" + ChatColor.GOLD + "#PiáTem" + ChatColor.DARK_RED + "] " + ChatColor.AQUA + "Varinha Mágica " + ChatColor.GRAY + "(" + ChatColor.GREEN + "Chamado Divino" + ChatColor.GRAY + ")", ChatColor.RED + "Dê a si mesmo, inumeros buffs!");
    12. ItemStack wandmag4 = Kit.createItem(Material.DIAMOND_HOE, ChatColor.DARK_RED + "[" + ChatColor.GOLD + "#PiáTem" + ChatColor.DARK_RED + "] " + ChatColor.AQUA + "Varinha Mágica " + ChatColor.GRAY + "(" + ChatColor.GREEN + "Bola de Fogo" + ChatColor.GRAY + ")", ChatColor.RED + "Jogue uma bola de fogo!");
    13. ItemStack wandmag5 = Kit.createItem(Material.DIAMOND_HOE, ChatColor.DARK_RED + "[" + ChatColor.GOLD + "#PiáTem" + ChatColor.DARK_RED + "] " + ChatColor.AQUA + "Varinha Mágica " + ChatColor.GRAY + "(" + ChatColor.GREEN + "Asas de Anjo" + ChatColor.GRAY + ")", ChatColor.RED + "I Belive i can fly!");
    14.  
    15. if(Kit.getKit(p) == Kit.MAGE)
    16. {
    17. if(p.isSneaking())
    18. {
    19. if(p.getItemInHand().equals(wandmag) && e.getAction() == Action.RIGHT_CLICK_AIR)
    20. {
    21. p.getInventory().setItem(1, wandmag1);
    22.  
    23. }
    24. if(p.getItemInHand().equals(wandmag1) && e.getAction() == Action.RIGHT_CLICK_AIR)
    25. {
    26. p.getInventory().setItem(1, wandmag2);
    27.  
    28. }
    29. if(p.getItemInHand().equals(wandmag2) && e.getAction() == Action.RIGHT_CLICK_AIR)
    30. {
    31. p.getInventory().setItem(1, wandmag3);
    32.  
    33. }
    34. if(p.getItemInHand().equals(wandmag) && e.getAction() == Action.RIGHT_CLICK_AIR)
    35. {
    36. p.getInventory().setItem(1, wandmag4);
    37.  
    38. }
    39. if(p.getItemInHand().equals(wandmag) && e.getAction() == Action.RIGHT_CLICK_AIR)
    40. {
    41. p.getInventory().setItem(1, wandmag5);
    42.  
    43. }
    44. if(p.getItemInHand().equals(wandmag5) && e.getAction() == Action.RIGHT_CLICK_AIR)
    45. {
    46. p.getInventory().setItem(1, wandmag1);
    47.  
    48. }
    49. }
    50.  
     
  15. Offline

    Zarkopafilis

    PlayerSneakEvent and PlayerInteractEvent
    dont forget to update inventory
     
  16. Offline

    PlayerNerd

  17. Offline

    Zarkopafilis

    Listen to player sneak event... if he sneaks add him to a map.... listen on interact event , if he is in the map , and it matches your stuff throw him up
     
  18. Offline

    teej107

    PlayerNerd
    Or you could just use isSneaking() rather than doing it yourself in the PlayerSneakEvent.
     
  19. Offline

    Zarkopafilis

    Oh i forgot
     
Thread Status:
Not open for further replies.

Share This Page