Advertisement
Guest User

Untitled

a guest
Jun 5th, 2013
34
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.TheLazeboy.Staves;
  2.  
  3. import org.bukkit.Location;
  4. import org.bukkit.Material;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.EventHandler;
  7. import org.bukkit.event.Listener;
  8. import org.bukkit.event.block.Action;
  9. import org.bukkit.event.player.PlayerInteractEvent;
  10.  
  11. public class MyPlayerListener implements Listener{
  12. public static Staves plugin;
  13.  
  14. @EventHandler
  15. public void onPlayerInteractBlock(PlayerInteractEvent evt){
  16. Player player = evt.getPlayer();
  17. Location locd = (Location) player.getTargetBlock(null, 10);
  18. if(evt.getPlayer().getItemInHand().getType() == Material.STICK){
  19. if (evt.getAction() == Action.RIGHT_CLICK_BLOCK || evt.getAction() == Action.RIGHT_CLICK_AIR) {
  20. player.getWorld().strikeLightning(locd);
  21. }
  22. }
  23. }
  24. }
Advertisement
RAW Paste Data Copied
Advertisement