Advertisement
Guest User

Untitled

a guest
May 15th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. public Map<Player, Long> thor = new HashMap<Player, Long>();
  2.  
  3. @EventHandler
  4. public void thorAttack(PlayerInteractEvent e) {
  5. Player p = e.getPlayer();
  6.  
  7. if (p instanceof Player) {
  8.  
  9. if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
  10. if (p.getItemInHand().getType().equals(Material.GOLD_AXE)) {
  11.  
  12. long temp = System.currentTimeMillis();
  13. if (thor.containsKey(e.getPlayer())) {
  14. if (10000 < temp - ((Long)thor.get(e.getPlayer())).longValue()) {
  15. if (PlayerKitManager.getInstance().has(p, Kit.THOR)) {
  16. p.getWorld().strikeLightning(p.getTargetBlock(null, 8).getLocation());
  17. e.setCancelled(true);
  18. thor.put(e.getPlayer(), Long.valueOf(temp));
  19.  
  20. }
  21.  
  22. }
  23.  
  24.  
  25.  
  26.  
  27. else {
  28. p.sendMessage(ChatColor.RED + "Sa ei saa seda veel kasutada!");
  29. e.setCancelled(true);
  30. }
  31. }
  32.  
  33. else {
  34. if (PlayerKitManager.getInstance().has(p, Kit.THOR)) {
  35. p.getWorld().strikeLightning(p.getTargetBlock(null, 8).getLocation());
  36. e.setCancelled(true);
  37. thor.put(e.getPlayer(), Long.valueOf(temp));
  38.  
  39. }
  40.  
  41. }
  42. }
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement