Kit PvP Help

Discussion in 'Bukkit Help' started by Phaluh, Apr 20, 2014.

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


    I have been custom coding a KitPvP plugin and i am stuck with this code i have got the ligthning right but i cannot seem to get it to hit the block the player is looking at instead of hitting them.
    1. @EventHandler
    2. public void onPlayerInteract(PlayerInteractEvent event){
    3. Player player = event.getPlayer();
    4. if(event.getAction().equals(Action.RIGHT_CLICK_AIR) && player.getItemInHand().getType() == Material.STONE_AXE){
    5. Player[] pl = event.getPlayer().getServer().getOnlinePlayers();
    6. Vector p_vec = event.getPlayer().getLocation().toVector();
    7. for(int i = 0; i<pl.length;i++){
    8. if(p_vec.distance(pl[i].getLocation().toVector())<15D){
    9. event.getPlayer().getWorld().strikeLightning(pl[i].getLocation());[/i][/i]
Thread Status:
Not open for further replies.

Share This Page