Java Code Examples for net.minecraft.entity.player.EntityPlayer.addChatMessage()

The following are Jave code examples for showing how to use addChatMessage() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: uniquecrops   File: GrowthSteps.java   View Source Code Vote up 6 votes
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {

	TileEntity tile = world.getTileEntity(pos);
	if (tile != null && tile instanceof TileFeroxia) {
		TileFeroxia te = (TileFeroxia)tile;
		EntityPlayer player = UCUtils.getPlayerFromUUID(te.getOwner().toString());
		if (!world.isRemote && player != null && world.getPlayerEntityByUUID(te.getOwner()) != null) {
			NBTTagCompound tag = player.getEntityData();
			if (!tag.hasKey("hasSacrificed"))
			{
				player.addChatMessage(new TextComponentString(TextFormatting.RED + "The savage plant whispers: \"The time is right to perform a self sacrifice.\""));
				tag.setBoolean("hasSacrificed", false);
				return false;
			}
			if (tag.hasKey("hasSacrificed") && tag.getBoolean("hasSacrificed"))
			{
				tag.removeTag("hasSacrificed");
				world.setBlockState(pos, ((Feroxia)state.getBlock()).withAge(7), 2);
				GrowthSteps.generateSteps(player);
				return false;
			}
		}
	}
	return false;
}
 
Example 2
Project: DecompiledMinecraft   File: CommandMessageRaw.java   View Source Code Vote up 6 votes
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);
        String s = buildString(args, 1);

        try
        {
            IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s);
            entityplayer.addChatMessage(ChatComponentProcessor.processComponent(sender, ichatcomponent, entityplayer));
        }
        catch (JsonParseException jsonparseexception)
        {
            Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception);
            throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()});
        }
    }
}
 
Example 3
Project: AuthMod   File: LoginCommand.java   View Source Code Vote up 6 votes
@Override
	public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
		EntityPlayer player = (EntityPlayer) sender;
if(Main.passwords.containsKey(player.getName())){
	if( Main.passwords.get(player.getName()).equals(args[0])){
		Main.logged.add(player.getName());
		Main.time.remove(player.getName());
		
		player.addChatMessage(new TextComponentString(TextFormatting.GREEN + (String)Main.config.get("loggedmessage")));
	}
	else {
		player.addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("wrongpass")));
	}
} else {
	player.addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("registermessage")));
}
	}
 
Example 4
Project: CustomWorldGen   File: CommandMessageRaw.java   View Source Code Vote up 6 votes
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(server, sender, args[0]);
        String s = buildString(args, 1);

        try
        {
            ITextComponent itextcomponent = ITextComponent.Serializer.jsonToComponent(s);
            entityplayer.addChatMessage(TextComponentUtils.processComponent(sender, itextcomponent, entityplayer));
        }
        catch (JsonParseException jsonparseexception)
        {
            /**
             * Convert a JsonParseException into a user-friendly exception
             */
            throw toSyntaxException(jsonparseexception);
        }
    }
}
 
Example 5
Project: BaseClient   File: CommandMessageRaw.java   View Source Code Vote up 6 votes
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);
        String s = buildString(args, 1);

        try
        {
            IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s);
            entityplayer.addChatMessage(ChatComponentProcessor.processComponent(sender, ichatcomponent, entityplayer));
        }
        catch (JsonParseException jsonparseexception)
        {
            Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception);
            throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()});
        }
    }
}
 
Example 6
Project: BaseClient   File: CommandMessageRaw.java   View Source Code Vote up 6 votes
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);
        String s = buildString(args, 1);

        try
        {
            IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s);
            entityplayer.addChatMessage(ChatComponentProcessor.processComponent(sender, ichatcomponent, entityplayer));
        }
        catch (JsonParseException jsonparseexception)
        {
            Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception);
            throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()});
        }
    }
}
 
Example 7
Project: uniquecrops   File: UCEventHandlerServer.java   View Source Code Vote up 6 votes
@SubscribeEvent
public void setUpgradeChance(AnvilRepairEvent event) {
	
	ItemStack output = event.getItemResult();
	EntityPlayer player = event.getEntityPlayer();
	if (output == null)
		return;
	if (player == null)
		return;
	
	if (player.worldObj.isRemote)
		return;
	
	if (output.getItem() instanceof IBookUpgradeable) {
		int upgradelevel = NBTUtils.getInt(output, ItemGeneric.TAG_UPGRADE, -1);
		if (upgradelevel == 10) {
			Random rand = new Random();
			if (rand.nextBoolean() == false && !player.worldObj.isRemote) {
				player.addChatMessage(new TextComponentString(TextFormatting.RED + "You attempt to refine this item, but it breaks.."));
				output.stackSize = 0;
			}
		}
	}
}
 
Example 8
Project: minecraft-quiverbow   File: AI_Communication.java   View Source Code Vote up 5 votes
public static void tellOwnerAboutDeath(Entity_AA turret)
{
	// Is empty, so telling the owner about this
	EntityPlayer owner = turret.worldObj.getPlayerEntityByName(turret.ownerName);

	if (owner == null) { return; }	// Might not be online right now
	
	// My name
	String turretName = "ARMS ASSISTANT " + turret.getEntityId();
	if (turret.getCustomNameTag() != null && !turret.getCustomNameTag().isEmpty()) { turretName = turret.getCustomNameTag(); }

	owner.addChatMessage(new ChatComponentText(EnumChatFormatting.GRAY + turretName + " was destroyed!"));
}
 
Example 9
Project: Backmemed   File: CommandGameMode.java   View Source Code Vote up 5 votes
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length <= 0)
    {
        throw new WrongUsageException("commands.gamemode.usage", new Object[0]);
    }
    else
    {
        GameType gametype = this.getGameModeFromCommand(sender, args[0]);
        EntityPlayer entityplayer = args.length >= 2 ? getPlayer(server, sender, args[1]) : getCommandSenderAsPlayer(sender);
        entityplayer.setGameType(gametype);
        ITextComponent itextcomponent = new TextComponentTranslation("gameMode." + gametype.getName(), new Object[0]);

        if (sender.getEntityWorld().getGameRules().getBoolean("sendCommandFeedback"))
        {
            entityplayer.addChatMessage(new TextComponentTranslation("gameMode.changed", new Object[] {itextcomponent}));
        }

        if (entityplayer == sender)
        {
            notifyCommandListener(sender, this, 1, "commands.gamemode.success.self", new Object[] {itextcomponent});
        }
        else
        {
            notifyCommandListener(sender, this, 1, "commands.gamemode.success.other", new Object[] {entityplayer.getName(), itextcomponent});
        }
    }
}
 
Example 10
Project: AuthMod   File: See.java   View Source Code Vote up 5 votes
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	EntityPlayer player = (EntityPlayer) sender;
	if(player.canCommandSenderUseCommand(3, "com.auth.mod.commands.see")){
	player.addChatMessage(makesimpletext((String) Main.passwords.get(args[0])));

}
}
 
Example 11
Project: Backmemed   File: CommandMessage.java   View Source Code Vote up 5 votes
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(server, sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget");
        }
        else
        {
            ITextComponent itextcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), itextcomponent.createCopy()});
            TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), itextcomponent.createCopy()});
            textcomponenttranslation.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
            textcomponenttranslation1.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(textcomponenttranslation);
            sender.addChatMessage(textcomponenttranslation1);
        }
    }
}
 
Example 12
Project: BaseClient   File: CommandGameMode.java   View Source Code Vote up 5 votes
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length <= 0)
    {
        throw new WrongUsageException("commands.gamemode.usage", new Object[0]);
    }
    else
    {
        WorldSettings.GameType worldsettings$gametype = this.getGameModeFromCommand(sender, args[0]);
        EntityPlayer entityplayer = args.length >= 2 ? getPlayer(sender, args[1]) : getCommandSenderAsPlayer(sender);
        entityplayer.setGameType(worldsettings$gametype);
        entityplayer.fallDistance = 0.0F;

        if (sender.getEntityWorld().getGameRules().getBoolean("sendCommandFeedback"))
        {
            entityplayer.addChatMessage(new ChatComponentTranslation("gameMode.changed", new Object[0]));
        }

        IChatComponent ichatcomponent = new ChatComponentTranslation("gameMode." + worldsettings$gametype.getName(), new Object[0]);

        if (entityplayer != sender)
        {
            notifyOperators(sender, this, 1, "commands.gamemode.success.other", new Object[] {entityplayer.getName(), ichatcomponent});
        }
        else
        {
            notifyOperators(sender, this, 1, "commands.gamemode.success.self", new Object[] {ichatcomponent});
        }
    }
}
 
Example 13
Project: BaseClient   File: CommandMessage.java   View Source Code Vote up 5 votes
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
        }
        else
        {
            IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), ichatcomponent.createCopy()});
            ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), ichatcomponent.createCopy()});
            chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(chatcomponenttranslation);
            sender.addChatMessage(chatcomponenttranslation1);
        }
    }
}
 
Example 14
Project: BaseClient   File: CommandGameMode.java   View Source Code Vote up 5 votes
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length <= 0)
    {
        throw new WrongUsageException("commands.gamemode.usage", new Object[0]);
    }
    else
    {
        WorldSettings.GameType worldsettings$gametype = this.getGameModeFromCommand(sender, args[0]);
        EntityPlayer entityplayer = args.length >= 2 ? getPlayer(sender, args[1]) : getCommandSenderAsPlayer(sender);
        entityplayer.setGameType(worldsettings$gametype);
        entityplayer.fallDistance = 0.0F;

        if (sender.getEntityWorld().getGameRules().getBoolean("sendCommandFeedback"))
        {
            entityplayer.addChatMessage(new ChatComponentTranslation("gameMode.changed", new Object[0]));
        }

        IChatComponent ichatcomponent = new ChatComponentTranslation("gameMode." + worldsettings$gametype.getName(), new Object[0]);

        if (entityplayer != sender)
        {
            notifyOperators(sender, this, 1, "commands.gamemode.success.other", new Object[] {entityplayer.getName(), ichatcomponent});
        }
        else
        {
            notifyOperators(sender, this, 1, "commands.gamemode.success.self", new Object[] {ichatcomponent});
        }
    }
}
 
Example 15
Project: DecompiledMinecraft   File: ServerCommandManager.java   View Source Code Vote up 4 votes
/**
 * Send an informative message to the server operators
 */
public void notifyOperators(ICommandSender sender, ICommand command, int flags, String msgFormat, Object... msgParams)
{
    boolean flag = true;
    MinecraftServer minecraftserver = MinecraftServer.getServer();

    if (!sender.sendCommandFeedback())
    {
        flag = false;
    }

    IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new ChatComponentTranslation(msgFormat, msgParams)});
    ichatcomponent.getChatStyle().setColor(EnumChatFormatting.GRAY);
    ichatcomponent.getChatStyle().setItalic(Boolean.valueOf(true));

    if (flag)
    {
        for (EntityPlayer entityplayer : minecraftserver.getConfigurationManager().func_181057_v())
        {
            if (entityplayer != sender && minecraftserver.getConfigurationManager().canSendCommands(entityplayer.getGameProfile()) && command.canCommandSenderUseCommand(sender))
            {
                boolean flag1 = sender instanceof MinecraftServer && MinecraftServer.getServer().func_183002_r();
                boolean flag2 = sender instanceof RConConsoleSource && MinecraftServer.getServer().func_181034_q();

                if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer))
                {
                    entityplayer.addChatMessage(ichatcomponent);
                }
            }
        }
    }

    if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands"))
    {
        minecraftserver.addChatMessage(ichatcomponent);
    }

    boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback");

    if (sender instanceof CommandBlockLogic)
    {
        flag3 = ((CommandBlockLogic)sender).shouldTrackOutput();
    }

    if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer)
    {
        sender.addChatMessage(new ChatComponentTranslation(msgFormat, msgParams));
    }
}
 
Example 16
Project: minecraft-territorialdealings   File: Main.java   View Source Code Vote up 4 votes
public static void sendMessageToPlayer(EntityPlayer player, String msg)
{
	player.addChatMessage(new TextComponentString(msg));
}
 
Example 17
Project: DecompiledMinecraft   File: ServerCommandManager.java   View Source Code Vote up 4 votes
/**
 * Send an informative message to the server operators
 */
public void notifyOperators(ICommandSender sender, ICommand command, int flags, String msgFormat, Object... msgParams)
{
    boolean flag = true;
    MinecraftServer minecraftserver = MinecraftServer.getServer();

    if (!sender.sendCommandFeedback())
    {
        flag = false;
    }

    IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new ChatComponentTranslation(msgFormat, msgParams)});
    ichatcomponent.getChatStyle().setColor(EnumChatFormatting.GRAY);
    ichatcomponent.getChatStyle().setItalic(Boolean.valueOf(true));

    if (flag)
    {
        for (EntityPlayer entityplayer : minecraftserver.getConfigurationManager().func_181057_v())
        {
            if (entityplayer != sender && minecraftserver.getConfigurationManager().canSendCommands(entityplayer.getGameProfile()) && command.canCommandSenderUseCommand(sender))
            {
                boolean flag1 = sender instanceof MinecraftServer && MinecraftServer.getServer().func_183002_r();
                boolean flag2 = sender instanceof RConConsoleSource && MinecraftServer.getServer().func_181034_q();

                if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer))
                {
                    entityplayer.addChatMessage(ichatcomponent);
                }
            }
        }
    }

    if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands"))
    {
        minecraftserver.addChatMessage(ichatcomponent);
    }

    boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback");

    if (sender instanceof CommandBlockLogic)
    {
        flag3 = ((CommandBlockLogic)sender).shouldTrackOutput();
    }

    if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer)
    {
        sender.addChatMessage(new ChatComponentTranslation(msgFormat, msgParams));
    }
}
 
Example 18
Project: uniquecrops   File: ItemGeneric.java   View Source Code Vote up 4 votes
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {

	if (stack.getItemDamage() == EnumItems.GUIDE.ordinal() && hand == EnumHand.MAIN_HAND && !player.isSneaking()) {
		if (!world.isRemote && (!player.getEntityData().hasKey(GrowthSteps.TAG_GROWTHSTAGES) || (player.getEntityData().hasKey(GrowthSteps.TAG_GROWTHSTAGES) && !stack.getTagCompound().hasKey(GrowthSteps.TAG_GROWTHSTAGES))))
			UCUtils.updateBook(player);
		player.openGui(UniqueCrops.instance, 0, world, (int)player.posX, (int)player.posY, (int)player.posZ);
		return new ActionResult(EnumActionResult.SUCCESS, stack);
	}
	if (stack.getItemDamage() == EnumItems.POTIONSPLASH.ordinal()) {
        if (!player.capabilities.isCreativeMode)
            --stack.stackSize;

        world.playSound((EntityPlayer)null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_SPLASH_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
        if (!world.isRemote)
        {
            EntityCustomPotion entitypotion = new EntityCustomPotion(world, player, stack);
            entitypotion.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, -20.0F, 0.5F, 1.0F);
            world.spawnEntityInWorld(entitypotion);
        }
        return new ActionResult(EnumActionResult.SUCCESS, stack);
	}
	if (stack.getItemDamage() == EnumItems.WEEPINGEYE.ordinal()) {
        if (!player.capabilities.isCreativeMode)
            --stack.stackSize;

        world.playSound((EntityPlayer)null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ENDERPEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
        if (!world.isRemote)
        {
            EntityItemWeepingEye eye = new EntityItemWeepingEye(world, player.posX, player.posY + 1.5D, player.posZ);
            eye.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
            world.spawnEntityInWorld(eye);
        }
        return new ActionResult(EnumActionResult.SUCCESS, stack);
	}
	if (stack.getItemDamage() == EnumItems.DOGRESIDUE.ordinal()) {
		boolean canFill = false;
		for (int i = 0; i < player.inventory.getSizeInventory() - player.inventory.armorInventory.length; i++) {
			ItemStack loopstack = player.inventory.getStackInSlot(i);
			if (loopstack == null) {
				player.inventory.setInventorySlotContents(i, new ItemStack(this, 1, 21));
				canFill = true;
			}
		}
		if (!world.isRemote)
		{
			if (canFill)
				player.addChatMessage(new TextComponentString("The rest of your inventory filled up with dog residue."));
			else
				player.addChatMessage(new TextComponentString("You finished using it. An uneasy silence fills the room."));
		}
		return new ActionResult(EnumActionResult.SUCCESS, stack);
	}
	if (stack.getItemDamage() == EnumItems.EULA.ordinal()) {
        if (!player.capabilities.isCreativeMode)
            --stack.stackSize;

        world.playSound((EntityPlayer)null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
        if (!world.isRemote)
        {
            EntityEulaBook entitybook = new EntityEulaBook(world, player, stack);
            entitybook.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, -20.0F, 0.5F, 1.0F);
            world.spawnEntityInWorld(entitybook);
        }
        return new ActionResult(EnumActionResult.SUCCESS, stack);
	}
	return new ActionResult(EnumActionResult.PASS, stack);
}
 
Example 19
Project: CustomWorldGen   File: ServerCommandManager.java   View Source Code Vote up 4 votes
/**
 * Send an informative message to the server operators
 */
public void notifyListener(ICommandSender sender, ICommand command, int flags, String translationKey, Object... translationArgs)
{
    boolean flag = true;
    MinecraftServer minecraftserver = this.server;

    if (!sender.sendCommandFeedback())
    {
        flag = false;
    }

    ITextComponent itextcomponent = new TextComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new TextComponentTranslation(translationKey, translationArgs)});
    itextcomponent.getStyle().setColor(TextFormatting.GRAY);
    itextcomponent.getStyle().setItalic(Boolean.valueOf(true));

    if (flag)
    {
        for (EntityPlayer entityplayer : minecraftserver.getPlayerList().getPlayerList())
        {
            if (entityplayer != sender && minecraftserver.getPlayerList().canSendCommands(entityplayer.getGameProfile()) && command.checkPermission(this.server, sender))
            {
                boolean flag1 = sender instanceof MinecraftServer && this.server.shouldBroadcastConsoleToOps();
                boolean flag2 = sender instanceof RConConsoleSource && this.server.shouldBroadcastRconToOps();

                if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer))
                {
                    entityplayer.addChatMessage(itextcomponent);
                }
            }
        }
    }

    if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands"))
    {
        minecraftserver.addChatMessage(itextcomponent);
    }

    boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback");

    if (sender instanceof CommandBlockBaseLogic)
    {
        flag3 = ((CommandBlockBaseLogic)sender).shouldTrackOutput();
    }

    if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer)
    {
        sender.addChatMessage(new TextComponentTranslation(translationKey, translationArgs));
    }
}
 
Example 20
Project: BaseClient   File: ServerCommandManager.java   View Source Code Vote up 4 votes
/**
 * Send an informative message to the server operators
 */
public void notifyOperators(ICommandSender sender, ICommand command, int flags, String msgFormat, Object... msgParams)
{
    boolean flag = true;
    MinecraftServer minecraftserver = MinecraftServer.getServer();

    if (!sender.sendCommandFeedback())
    {
        flag = false;
    }

    IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new ChatComponentTranslation(msgFormat, msgParams)});
    ichatcomponent.getChatStyle().setColor(EnumChatFormatting.GRAY);
    ichatcomponent.getChatStyle().setItalic(Boolean.valueOf(true));

    if (flag)
    {
        for (EntityPlayer entityplayer : minecraftserver.getConfigurationManager().func_181057_v())
        {
            if (entityplayer != sender && minecraftserver.getConfigurationManager().canSendCommands(entityplayer.getGameProfile()) && command.canCommandSenderUseCommand(sender))
            {
                boolean flag1 = sender instanceof MinecraftServer && MinecraftServer.getServer().func_183002_r();
                boolean flag2 = sender instanceof RConConsoleSource && MinecraftServer.getServer().func_181034_q();

                if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer))
                {
                    entityplayer.addChatMessage(ichatcomponent);
                }
            }
        }
    }

    if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands"))
    {
        minecraftserver.addChatMessage(ichatcomponent);
    }

    boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback");

    if (sender instanceof CommandBlockLogic)
    {
        flag3 = ((CommandBlockLogic)sender).shouldTrackOutput();
    }

    if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer)
    {
        sender.addChatMessage(new ChatComponentTranslation(msgFormat, msgParams));
    }
}