mcMMO/src/main/java/com/gmail/nossr50/commands/mc/McrefreshCommand.java

69 lines
2.3 KiB
Java
Raw Normal View History

2012-01-09 20:00:13 +01:00
package com.gmail.nossr50.commands.mc;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.datatypes.AbilityType;
2012-01-09 20:00:13 +01:00
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.ToolType;
2012-01-09 20:00:13 +01:00
import com.gmail.nossr50.locale.mcLocale;
public class McrefreshCommand implements CommandExecutor {
private final mcMMO plugin;
public McrefreshCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
2012-03-26 22:17:35 +02:00
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
2012-01-09 20:00:13 +01:00
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (!mcPermissions.getInstance().mcrefresh(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (args.length >= 1 && (plugin.getServer().getPlayer(args[0]) != null)) {
2012-03-26 22:17:35 +02:00
player.sendMessage("You have refreshed " + args[0] + "'s cooldowns!"); //TODO: Needs more locale.
2012-01-09 20:00:13 +01:00
player = plugin.getServer().getPlayer(args[0]);
}
/*
* PREP MODES
*/
PP = Users.getProfile(player);
PP.setRecentlyHurt((long) 0);
PP.setToolPreparationMode(ToolType.AXE, false);
PP.setToolPreparationMode(ToolType.FISTS, false);
PP.setToolPreparationMode(ToolType.HOE, false);
PP.setToolPreparationMode(ToolType.PICKAXE, false);
PP.setToolPreparationMode(ToolType.SWORD, false);
//RESET COOLDOWNS
PP.resetCooldowns();
PP.setAbilityMode(AbilityType.GREEN_TERRA, false);
PP.setAbilityMode(AbilityType.GIGA_DRILL_BREAKER, false);
PP.setAbilityMode(AbilityType.SERRATED_STRIKES, false);
PP.setAbilityMode(AbilityType.SUPER_BREAKER, false);
PP.setAbilityMode(AbilityType.TREE_FELLER, false);
PP.setAbilityMode(AbilityType.BERSERK, false);
2012-01-09 20:00:13 +01:00
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesRefreshed"));
return true;
}
}