2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.commands;
|
|
|
|
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
|
2013-10-29 16:45:27 +01:00
|
|
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
|
|
|
import com.gmail.nossr50.util.Permissions;
|
2013-03-12 21:25:42 +01:00
|
|
|
|
2013-03-28 17:57:49 +01:00
|
|
|
public class McabilityCommand extends ToggleCommand {
|
2013-03-01 06:52:01 +01:00
|
|
|
@Override
|
2013-03-28 17:57:49 +01:00
|
|
|
protected boolean hasOtherPermission(CommandSender sender) {
|
|
|
|
return Permissions.mcabilityOthers(sender);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
2013-03-12 21:25:42 +01:00
|
|
|
|
2013-03-28 17:57:49 +01:00
|
|
|
@Override
|
|
|
|
protected boolean hasSelfPermission(CommandSender sender) {
|
|
|
|
return Permissions.mcability(sender);
|
|
|
|
}
|
2013-03-12 21:25:42 +01:00
|
|
|
|
2013-03-28 17:57:49 +01:00
|
|
|
@Override
|
2013-10-29 16:45:27 +01:00
|
|
|
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
|
|
|
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Ability." + (mcMMOPlayer.getAbilityUse() ? "Off" : "On")));
|
2013-03-12 21:25:42 +01:00
|
|
|
mcMMOPlayer.toggleAbilityUse();
|
|
|
|
}
|
2013-03-28 17:57:49 +01:00
|
|
|
|
|
|
|
@Override
|
2013-10-29 16:45:27 +01:00
|
|
|
protected void sendSuccessMessage(CommandSender sender, String playerName) {
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Toggle", playerName));
|
2013-03-28 17:57:49 +01:00
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|