本文整理匯總了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));
}
}