本文整理汇总了Java中net.minecraft.server.MinecraftServer.addChatMessage方法的典型用法代码示例。如果您正苦于以下问题:Java MinecraftServer.addChatMessage方法的具体用法?Java MinecraftServer.addChatMessage怎么用?Java MinecraftServer.addChatMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.server.MinecraftServer
的用法示例。
在下文中一共展示了MinecraftServer.addChatMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyOperators
import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
/**
* 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));
}
}
示例2: notifyListener
import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
/**
* 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));
}
}