Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Map<Player, Long> thor = new HashMap<Player, Long>();
- @EventHandler
- public void thorAttack(PlayerInteractEvent e) {
- Player p = e.getPlayer();
- if (p instanceof Player) {
- if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
- if (p.getItemInHand().getType().equals(Material.GOLD_AXE)) {
- long temp = System.currentTimeMillis();
- if (thor.containsKey(e.getPlayer())) {
- if (10000 < temp - ((Long)thor.get(e.getPlayer())).longValue()) {
- if (PlayerKitManager.getInstance().has(p, Kit.THOR)) {
- p.getWorld().strikeLightning(p.getTargetBlock(null, 8).getLocation());
- e.setCancelled(true);
- thor.put(e.getPlayer(), Long.valueOf(temp));
- }
- }
- else {
- p.sendMessage(ChatColor.RED + "Sa ei saa seda veel kasutada!");
- e.setCancelled(true);
- }
- }
- else {
- if (PlayerKitManager.getInstance().has(p, Kit.THOR)) {
- p.getWorld().strikeLightning(p.getTargetBlock(null, 8).getLocation());
- e.setCancelled(true);
- thor.put(e.getPlayer(), Long.valueOf(temp));
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement