How to get the Projectile shot from a hoe?

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

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

    Slash9211

    I was wonder how would I get the projectile shot from a wood hoe? I don't know what even to use for this... Cause ShootBow is for a bow obviously... and PlayerInteraction Doesn't let me get it unless if theres a way around one of them...
     
  2. Offline

    Cerberus XII

    Slash9211, Use the PlayerInteractEvent.
    Code:java
    1. @EventHandler
    2. public void onPlayerInteract(PlayerInteractEvent event) {
    3. Player p = event.getPlayer();
    4.  
    5. if(p.getInventory().getItemInHand().equals(Material.WOOD_HOE) && event.getAction().equals(Action.RIGHT_CLICK_AIR)) {
    6.  
    7. }
    8. }
     
  3. Offline

    Laxer21117

    Code:java
    1. public class Class extends JavaPlugin implements Listener {
    2.  
    3. @Override
    4. public void onEnable() {
    5. getServer().getPluginManager().registerEvents("this, this");
    6. }
    7.  
    8. @Override
    9. public void onDisable() {
    10.  
    11. {
    12.  
    13. @EventHandler
    14. public void onClick(PlayerInteractEvent e) {
    15. if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
    16. Player p = e.getPlayer();
    17. if(p.getItemName().getType() == Material.WOOD_HOE);
     
  4. Offline

    Slash9211

    Cerberus XII Laxer21117 not shoot, I got that part already. I'm trying to get the ItemMeta from the projectile shot FROM the wood hoe...
     
  5. Offline

    fireblast709

    Slash9211 perhaps get the shooter on ProjectileLaunchEvent, check if it is a Player, cast to Player, get held item, check for null, check material, get ItemMeta
     
Thread Status:
Not open for further replies.

Share This Page