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

49 lines
1.4 KiB
Java
Raw Normal View History

2012-01-09 20:00:13 +01:00
package com.gmail.nossr50.commands.mc;
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.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
public class McabilityCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (player != null && player.hasPermission("mcmmo.commands.ability")) {
2012-01-09 20:00:13 +01:00
sender.sendMessage("This command requires permissions.");
return true;
}
if (!LoadProperties.mcabilityEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
PlayerProfile PP = Users.getProfile(player);
if (PP.getAbilityUse()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOff"));
PP.toggleAbilityUse();
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOn"));
PP.toggleAbilityUse();
}
return true;
}
}