Hold-able torches

Discussion in 'Archived: Plugin Requests' started by Weasels30, Mar 14, 2014.

  1. Offline

    Weasels30

    I just wanted to know if it was possible to make a plugin where it detects whether a player is holding a torch (50) or a redstone torch that is on (76).

    While you're holding a torch (50) it would give the player the potion id NIGHT_VISION 2
    While you're holding a redstone torch that's on (76) then it would give the player the potion id NIGHT_VISION 1

    I just want to know whether or not it's possible and how this would be done if it is because I have not gotten into messing with potion effects in plugin development yet. Thanks in advanced, the person who answers will be given credit.
     
  2. Offline

    PotatoTears

  3. Offline

    webbhead

    Weasels30
    I will be having a go at this.

    Weasels30
    Would it be okay if you had to right click it to enable it?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  4. Offline

    MrCodeMiner

    Weasels30 I made the plugin with some help of my friend. I'm sorry webbhead if you wanted to make this. Feel free to contact me to help me develop it more. Because i'll need some help with that. Also, I have the source code at github so you can take it for your own plugin.
    http://dev.bukkit.org/bukkit-plugins/hold-able-torches/

    I'm guessing you're having the same problem i had. where there seems no option to check for a torch in someone's hand? Well, after chatting for some time with my friend we finally found a way around it. without causing lag. View my code at github (https://github.com/Minecraftfailzzz/HoldAbleTorches) if you want to see how we did it. Also please contact me if you want to help me develop this plugin even further.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  5. Offline

    jeussa

    No need to enable and disable it on an interact event.
    Just look for the PlayerItemHeldEvent (which is triggered when the item a player's holding changes)
     
  6. Offline

    MrCodeMiner

    Yes I know, that's how I did it. But it needed a little extra because at first it would see what item was hold when switched away. so I had to do some extra stuff but yeah it was with the PlayerItemHeldEvent.
    thanks for telling me anyway :)
     
  7. Offline

    webbhead

    I would love to help develop the plugin :)! Message me on Skype at: webbhead58
     

Share This Page