Left Click / Right Click Item with custom name

Discussion in 'Plugin Development' started by PonyFreedom, Feb 15, 2016.

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

    PonyFreedom

    I want to make wand like wood stick with name Oak wand and when player left click i want make it to make some particles and damage how i can do this and im new so pls keep it easy
     
  2. Offline

    PonyFreedom

    I already read not all of it but oke i'll try to do it
     
  3. Offline

    Super10Gamer

    I don't understand... You want to others make for you or you want to YOU make this ?
     
  4. Offline

    PonyFreedom

    @Super10Gamer
    I want you just to help me no to make all the plugin
     
  5. Offline

    DoggyCode™

    Listen to PlayerInteractEvent? Get item in hand, if it has the display name "Oak wand" or whatever do your stuff.
     
  6. Offline

    PonyFreedom

  7. @PonyFreedom
    What you mean by "show", is to code everything you need so you can copy it.
    Start with a tutorial as up to date as you can find. Nearly all of them suck, but you should get the basic idea.
    If you haven't learned Java yet, I highly recommend you do so before starting any of this.
     
  8. Offline

    Super10Gamer

    A Base:
    Code:
        @EventHandler(priority = EventPriority.HIGHEST)
        public void PlayerUse(PlayerInteractEvent e) {
            Player p = e.getPlayer();
            }
     
  9. Offline

    Zombie_Striker

    Last edited by a moderator: Feb 15, 2016
  10. Offline

    PonyFreedom

    @DoggyCode™ @Super10Gamer
    Code:
    public class ClickListener implements Listener {
      
        @EventHandler
        public void onClick(PlayerInteractEvent event) {
          
            Player player = event.getPlayer();
            if (player.getItemInHand().getType().equals(Action.LEFT_CLICK_AIR)) {
              
            }
        }
    
    }
    How to make it shoot particles and make the particle do damage?
     
  11. Offline

    Zombie_Striker

    @PonyFreedom
    Particles do not do any damage.

    Use the World.playEffect method to spawn particles.
     
  12. Offline

    PonyFreedom

    @Zombie_Striker
    Oke well if i make it spawn and something like invisible snow ball and make the damage on the snow ball ?
     
  13. Offline

    poepdrolify

    If I were you, read the bukkit javadocs.
    Pseudo code:
    Check for PlayerInteractEvent
    If player itemhand has the name "Magic wand"
    If action equals left click air
    Spawn shooting snowball
    Add particles to snowball
    To set custom damage try to set the snowball's damage.

    I dunno if this is correct, wrote it on my phone.
     
  14. Offline

    JoaoBM

    Zombie_Striker likes this.
Thread Status:
Not open for further replies.

Share This Page