1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2025-04-03 10:16:23 +02:00
mcMMO/src/main/java/com/gmail/nossr50/commands/AbilityToggleCommand.java
2021-03-19 13:40:38 -07:00

30 lines
1007 B
Java

package com.gmail.nossr50.commands;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.CommandSender;
public class AbilityToggleCommand extends ToggleCommand {
@Override
protected boolean hasOtherPermission(CommandSender sender) {
return Permissions.mcabilityOthers(sender);
}
@Override
protected boolean hasSelfPermission(CommandSender sender) {
return Permissions.mcability(sender);
}
@Override
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Ability." + (mcMMOPlayer.getAbilityUse() ? "Off" : "On")));
mcMMOPlayer.toggleAbilityUse();
}
@Override
protected void sendSuccessMessage(CommandSender sender, String playerName) {
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Toggle", playerName));
}
}