Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.03 KB | None | 0 0
  1. package me.veverka.potion.Commands;
  2.  
  3. import me.veverka.potion.Main;
  4.  
  5. import java.util.HashMap;
  6.  
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.CommandExecutor;
  9. import org.bukkit.command.CommandSender;
  10. import org.bukkit.entity.Player;
  11. import org.bukkit.potion.PotionEffect;
  12. import org.bukkit.potion.PotionEffectType;
  13.  
  14. public class Fury implements CommandExecutor {
  15.  
  16.     public HashMap<String, Long> cooldowns = new HashMap<String, Long>();
  17.     public boolean needUpdate = false;
  18.  
  19.     public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
  20.     {
  21.         if (!(sender instanceof Player)) {
  22.             return false;
  23.         }
  24.         Player player = (Player)sender;
  25.         if (!player.hasPermission("effect.fury")) {
  26.  
  27.             player.sendMessage(Main.prefix + "§cNo permission!");
  28.             return true;
  29.         }
  30.        
  31.           int cooldownTime = 6;
  32.           if (this.cooldowns.containsKey(player.getName()))
  33.           {
  34.             long secondsLeft = ((Long)this.cooldowns.get(player.getName())).longValue() / 1000L + cooldownTime - System.currentTimeMillis() / 1000L;
  35.             if (secondsLeft > 0L)
  36.             {
  37.               sender.sendMessage("§7Prosim vyckej jeste §6" + secondsLeft + " §7sekund pro znovupouziti itemu.");
  38.               return needUpdate;
  39.             }
  40.           }
  41.           this.cooldowns.put(player.getName(), Long.valueOf(System.currentTimeMillis()));
  42.  
  43.           player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 800, 1));
  44.           player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 800, 2));
  45.           player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 800, 2));
  46.           player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 800, 2));
  47.           player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 800, 1));
  48.           player.sendMessage(Main.prefix + "§eFury activated!");
  49.           return true;
  50.          
  51.           return needUpdate;
  52.      }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement