Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.veverka.potion.Commands;
- import me.veverka.potion.Main;
- import java.util.HashMap;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- public class Fury implements CommandExecutor {
- public HashMap<String, Long> cooldowns = new HashMap<String, Long>();
- public boolean needUpdate = false;
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
- {
- if (!(sender instanceof Player)) {
- return false;
- }
- Player player = (Player)sender;
- if (!player.hasPermission("effect.fury")) {
- player.sendMessage(Main.prefix + "§cNo permission!");
- return true;
- }
- int cooldownTime = 6;
- if (this.cooldowns.containsKey(player.getName()))
- {
- long secondsLeft = ((Long)this.cooldowns.get(player.getName())).longValue() / 1000L + cooldownTime - System.currentTimeMillis() / 1000L;
- if (secondsLeft > 0L)
- {
- sender.sendMessage("§7Prosim vyckej jeste §6" + secondsLeft + " §7sekund pro znovupouziti itemu.");
- return needUpdate;
- }
- }
- this.cooldowns.put(player.getName(), Long.valueOf(System.currentTimeMillis()));
- player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 800, 1));
- player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 800, 2));
- player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 800, 2));
- player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 800, 2));
- player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 800, 1));
- player.sendMessage(Main.prefix + "§eFury activated!");
- return true;
- return needUpdate;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement