Interactlistener

Discussion in 'Plugin Development' started by godveno, Jun 29, 2020.

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

    godveno

    Hey,

    I want to code something on the version 1.15.2. If I hold the Blaze Rod and right click a Player, he should get in a list. And if he dies, the Player who right clicked him should get Strength and Resistance.

    Can someone send the code here?
    If it's not understandable please say it, I will explain it better.
     
  2. Offline

    timtower Administrator Administrator Moderator

    @godveno And why would we just send the code?
    Why not make a plugin request?
     
  3. Offline

    godveno

    If you can't give a normal answer, I will do it in the "Plugin Request" if you feel better for that.
     
  4. Offline

    timtower Administrator Administrator Moderator

    @godveno Who do you want the code?
    Why not try to make it yourself and ask for help when you can't figure something out?
     
  5. Offline

    godveno

    Then say, how I should do it?
     
  6. Offline

    timtower Administrator Administrator Moderator

    @godveno Listen for the PlayerInteractEntityEvent.
    Check if the player is holding a blaze rod.
    Check if the entity being clicked is a player.

    Start with that ;)
     
  7. Offline

    godveno

    Okay, It's working... But how do i check if the Player is holding a blaze rod?
     
  8. Offline

    timtower Administrator Administrator Moderator

    Player#getInventory()#getItemInMainHand()
    Then check if it is null, if not null, check if the type is a blazerod
     
  9. Offline

    godveno

    I don't know if it's right, but I don't think that this is right.
    upload_2020-6-29_21-14-51.png
     
  10. Offline

    caderapee

    @godveno you need to cast the rightClick, (Player) e.getRickClicked
     
Thread Status:
Not open for further replies.

Share This Page