mcMMO/src/main/java/com/gmail/nossr50/commands/admin/McgodCommand.java

43 lines
1.3 KiB
Java
Raw Normal View History

package com.gmail.nossr50.commands.admin;
2012-01-09 20:00:13 +01:00
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
2012-04-05 06:44:12 +02:00
import com.gmail.nossr50.commands.CommandHelper;
2012-01-09 20:00:13 +01:00
import com.gmail.nossr50.datatypes.PlayerProfile;
2012-04-27 11:47:11 +02:00
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
2012-01-09 20:00:13 +01:00
public class McgodCommand implements CommandExecutor {
2012-04-05 06:44:12 +02:00
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mcgod")) {
return true;
}
2012-07-03 16:04:04 +02:00
PlayerProfile profile = Users.getProfile((Player) sender);
2012-04-05 06:44:12 +02:00
2012-10-31 01:59:58 +01:00
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
2012-07-03 16:04:04 +02:00
if (profile.getGodMode()) {
2012-04-27 11:47:11 +02:00
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
2012-04-05 06:44:12 +02:00
}
else {
2012-04-27 11:47:11 +02:00
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
2012-04-05 06:44:12 +02:00
}
2012-07-03 16:04:04 +02:00
profile.toggleGodMode();
2012-04-05 06:44:12 +02:00
return true;
}
2012-01-09 20:00:13 +01:00
}