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

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

package net.minecraft.server;

import java.util.Arrays;
import java.util.List;

public class CommandTell extends CommandAbstract {
	
	public CommandTell() {
	}
	
	public List b() {
		return Arrays.asList("w", "msg");
	}
	
	public String getCommand() {
		return "tell";
	}
	
	public int a() {
		return 0;
	}
	
	public String getUsage(ICommandListener icommandlistener) {
		return "commands.message.usage";
	}
	
	public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException {
		if (astring.length < 2) {
			throw new ExceptionUsage("commands.message.usage");
		} else {
			EntityPlayer entityplayer = a(icommandlistener, astring[0]);
			
			if (entityplayer == icommandlistener) {
				throw new ExceptionPlayerNotFound("commands.message.sameTarget");
			} else {
				IChatBaseComponent ichatbasecomponent = b(icommandlistener, astring, 1, !(icommandlistener instanceof EntityHuman));
				ChatMessage chatmessage = new ChatMessage("commands.message.display.incoming", icommandlistener.getScoreboardDisplayName(), ichatbasecomponent.f());
				ChatMessage chatmessage1 = new ChatMessage("commands.message.display.outgoing", entityplayer.getScoreboardDisplayName(), ichatbasecomponent.f());
				
				chatmessage.getChatModifier().setColor(EnumChatFormat.GRAY).setItalic(Boolean.valueOf(true));
				chatmessage1.getChatModifier().setColor(EnumChatFormat.GRAY).setItalic(Boolean.valueOf(true));
				entityplayer.sendMessage(chatmessage);
				icommandlistener.sendMessage(chatmessage1);
			}
		}
	}
	
	public List tabComplete(ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
		return a(astring, MinecraftServer.getServer().getPlayers());
	}
	
	public boolean isListStart(String[] astring, int i) {
		return i == 0;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy