Double Right Click

Discussion in 'Plugin Development' started by _Belknap_, Jan 28, 2014.

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

    _Belknap_

    Hello people!
    I am having a problem with this plugin that I am developing. . Basically, I'm trying to make it so that when you right click a wooden sword, it will place a pumpkin on your head, and then when you right click it again, it will take the pumpkin off your head. I've gotten it so that it places a pumpkin on your head, and I am having trouble doing the RightClickEvent thing.
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd,
    2. String commandLabel, String[] args) {
    3. Player player = (Player) sender;
    4. if(commandLabel.equalsIgnoreCase("aim")){
    5. ItemStack pumpkin = new ItemStack(Material.PUMPKIN,1);
    6. PlayerInventory pi = player.getInventory();
    7. pi.setHelmet(pumpkin);
    8. }
    9. return false;
    10.  
    11. }
    12.  
    13. }
     
  2. Offline

    iCopyright

    this should have been posted im plugin development.
     
  3. Offline

    DogeDev

    Such Wrong. Very Misplace.
     
  4. Offline

    !Phoenix!

  5. Offline

    xTrollxDudex

    _Belknap_
    Resources..........................? How..............................?

    DogeDev
    Such BAD GRAMMAR. Much BAD GRAMMAR.
     
    DogeDev likes this.
  6. Offline

    TheUpdater

    this is when you do command btw and its gona be in plugin devolopment

    do
    @EventHandler
    public void act(PlayerInteractEvent e)


    then check the Action
     
  7. Offline

    !Phoenix!

    TheUpdater
    1. Thanks for quoting the whole post
    2. Thanks for repeating what I have said before
    3. If you give a coding example like this you should also mention that the class has to be registered as listener class, otherwise this won't work whatsoever...
     
  8. Offline

    _Belknap_


    TheUpdater thankyou!
     
  9. Offline

    Jade

    Moved to correct section.
     
Thread Status:
Not open for further replies.

Share This Page