All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minecraft.server.CommandDeop Maven / Gradle / Ivy

package net.minecraft.server;

import com.mojang.authlib.GameProfile;

import java.util.List;

public class CommandDeop extends CommandAbstract {
	
	public CommandDeop() {
	}
	
	public String getCommand() {
		return "deop";
	}
	
	public int a() {
		return 3;
	}
	
	public String getUsage(ICommandListener icommandlistener) {
		return "commands.deop.usage";
	}
	
	public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException {
		if (astring.length == 1 && astring[0].length() > 0) {
			MinecraftServer minecraftserver = MinecraftServer.getServer();
			GameProfile gameprofile = minecraftserver.getPlayerList().getOPs().a(astring[0]);
			
			if (gameprofile == null) {
				throw new CommandException("commands.deop.failed", astring[0]);
			} else {
				minecraftserver.getPlayerList().removeOp(gameprofile);
				a(icommandlistener, this, "commands.deop.success", astring[0]);
			}
		} else {
			throw new ExceptionUsage("commands.deop.usage");
		}
	}
	
	public List tabComplete(ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
		return astring.length == 1 ? a(astring, MinecraftServer.getServer().getPlayerList().n()) : null;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy