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 McgodCommand 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.mcgodOthers(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.mcgod(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.GodMode." + (mcMMOPlayer.getGodMode() ? "Disabled" : "Enabled")));
|
2013-03-12 21:25:42 +01:00
|
|
|
mcMMOPlayer.toggleGodMode();
|
|
|
|
}
|
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.GodMode.Toggle", playerName));
|
2013-03-28 17:57:49 +01:00
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|