Bow/arrow plugin doesn't work, plz help!

Discussion in 'Plugin Development' started by quinster08, Nov 23, 2013.

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

    quinster08

    Hellp guys, i created a code but it doesn't work. The plugin loads fine and the plugin.yml is fine too. If i spawn the bow and i shoot, there come's no arrow out. Code:
    Code:
    import java.util.logging.Logger;
     
    import org.bukkit.Effect;
    import org.bukkit.Material;
    import org.bukkit.OfflinePlayer;
    import org.bukkit.entity.Arrow;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.EntityDamageByEntityEvent;
    import org.bukkit.plugin.java.JavaPlugin;
     
     
    public class Main extends JavaPlugin
      implements Listener
    {
      Logger log = Logger.getLogger("Minecraft");
    @Override
      public void onEnable()
      {
        this.log.info(this + " Plugin Enabled!");
        getServer().getPluginManager().registerEvents(this, this);
      }
     
      @Override
      public void onDisable() {
        this.log.info(this + " Plugin Disabled"); 
       
    }
     
     
     
    @EventHandler
      public void onDamage(EntityDamageByEntityEvent event){
        Arrow arrow = (Arrow) event.getDamager();
        if (arrow.getShooter() instanceof Player) {
            Player player = (Player) arrow.getShooter();
          if(event.getEntity() instanceof Player && event.getDamager() instanceof Arrow){
              Arrow a = ((OfflinePlayer) event).getPlayer().launchProjectile(Arrow.class);
              a.getWorld().playEffect(a.getLocation(), Effect.SMOKE, 10);
                if(player.getItemInHand().getType().equals(Material.BOW) && player.getItemInHand().getItemMeta().getDisplayName().equals("EmpireBow")){
     
    }
          }
      }
     
    }
    }
    Thx for reading/helping.
     
  2. Offline

    chasechocolate

    There's a bunch of incorrect stuff, for starters, you are casting before checking an instanceof, you are casting OfflienPlayer to an event, etc.
     
  3. Offline

    quinster08

  4. Offline

    xTrollxDudex

    quinster08
    We don't create plugins for you in the section if you intend on us giving code, it's simple enough to fix anyways
     
  5. Offline

    quinster08

  6. Offline

    achap1989

    quinster08 are you just trying to add a smoke trail?
     
  7. Offline

    AoH_Ruthless

    And you won't learn if you are spoonfed stuff. Chase already told you how to fix it.
     
    L33m4n123 likes this.
Thread Status:
Not open for further replies.

Share This Page