/** * Get the formatted ChatComponent that will be used for the sender's username in chat */ public IChatComponent getDisplayName() { if (this.hasCustomName()) { ChatComponentText chatcomponenttext = new ChatComponentText(this.entityName); chatcomponenttext.getChatStyle().setChatHoverEvent(this.getHoverEvent()); chatcomponenttext.getChatStyle().setInsertion(this.getUniqueID().toString()); return chatcomponenttext; } else { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(this.getName(), new Object[0]); chatcomponenttranslation.getChatStyle().setChatHoverEvent(this.getHoverEvent()); chatcomponenttranslation.getChatStyle().setInsertion(this.getUniqueID().toString()); return chatcomponenttranslation; } }
public void func_152892_c(ErrorCode p_152892_1_) { if (p_152892_1_ == ErrorCode.TTV_EC_SOUNDFLOWER_NOT_INSTALLED) { IChatComponent ichatcomponent = new ChatComponentTranslation("stream.unavailable.soundflower.chat.link", new Object[0]); ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://help.mojang.com/customer/portal/articles/1374877-configuring-soundflower-for-streaming-on-apple-computers")); ichatcomponent.getChatStyle().setUnderlined(Boolean.valueOf(true)); IChatComponent ichatcomponent1 = new ChatComponentTranslation("stream.unavailable.soundflower.chat", new Object[] {ichatcomponent}); ichatcomponent1.getChatStyle().setColor(EnumChatFormatting.DARK_RED); this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent1); } else { IChatComponent ichatcomponent2 = new ChatComponentTranslation("stream.unavailable.unknown.chat", new Object[] {ErrorCode.getString(p_152892_1_)}); ichatcomponent2.getChatStyle().setColor(EnumChatFormatting.DARK_RED); this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent2); } }
protected void listObjectives(ICommandSender p_147196_1_) throws CommandException { Scoreboard scoreboard = this.getScoreboard(); Collection<ScoreObjective> collection = scoreboard.getScoreObjectives(); if (collection.size() <= 0) { throw new CommandException("commands.scoreboard.objectives.list.empty", new Object[0]); } else { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.scoreboard.objectives.list.count", new Object[] {Integer.valueOf(collection.size())}); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); p_147196_1_.addChatMessage(chatcomponenttranslation); for (ScoreObjective scoreobjective : collection) { p_147196_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.objectives.list.entry", new Object[] {scoreobjective.getName(), scoreobjective.getDisplayName(), scoreobjective.getCriteria().getName()})); } } }
private static void initStats() { for (Item item : Item.itemRegistry) { if (item != null) { int i = Item.getIdFromItem(item); String s = func_180204_a(item); if (s != null) { objectUseStats[i] = (new StatCrafting("stat.useItem.", s, new ChatComponentTranslation("stat.useItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat(); if (!(item instanceof ItemBlock)) { itemStats.add((StatCrafting)objectUseStats[i]); } } } } replaceAllSimilarBlocks(objectUseStats); }
private static <T extends Entity> boolean isEntityTypeValid(ICommandSender commandSender, Map<String, String> params) { String s = func_179651_b(params, "type"); s = s != null && s.startsWith("!") ? s.substring(1) : s; if (s != null && !EntityList.isStringValidEntityName(s)) { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.entity.invalidType", new Object[] {s}); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); commandSender.addChatMessage(chatcomponenttranslation); return false; } else { return true; } }
private static void initItemDepleteStats() { for (Item item : Item.itemRegistry) { if (item != null) { int i = Item.getIdFromItem(item); String s = func_180204_a(item); if (s != null && item.isDamageable()) { objectBreakStats[i] = (new StatCrafting("stat.breakItem.", s, new ChatComponentTranslation("stat.breakItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat(); } } } replaceAllSimilarBlocks(objectBreakStats); }
private static void initMiningStats() { for (Block block : Block.blockRegistry) { Item item = Item.getItemFromBlock(block); if (item != null) { int i = Block.getIdFromBlock(block); String s = func_180204_a(item); if (s != null && block.getEnableStats()) { mineBlockStatArray[i] = (new StatCrafting("stat.mineBlock.", s, new ChatComponentTranslation("stat.mineBlock", new Object[] {(new ItemStack(block)).getChatComponent()}), item)).registerStat(); objectMineStats.add((StatCrafting)mineBlockStatArray[i]); } } } replaceAllSimilarBlocks(mineBlockStatArray); }
private void func_110669_a(ICommandSender p_110669_1_, List<Entity> p_110669_2_, CommandSpreadPlayers.Position p_110669_3_, double p_110669_4_, double p_110669_6_, World worldIn, boolean p_110669_9_) throws CommandException { Random random = new Random(); double d0 = p_110669_3_.field_111101_a - p_110669_6_; double d1 = p_110669_3_.field_111100_b - p_110669_6_; double d2 = p_110669_3_.field_111101_a + p_110669_6_; double d3 = p_110669_3_.field_111100_b + p_110669_6_; CommandSpreadPlayers.Position[] acommandspreadplayers$position = this.func_110670_a(random, p_110669_9_ ? this.func_110667_a(p_110669_2_) : p_110669_2_.size(), d0, d1, d2, d3); int i = this.func_110668_a(p_110669_3_, p_110669_4_, worldIn, random, d0, d1, d2, d3, acommandspreadplayers$position, p_110669_9_); double d4 = this.func_110671_a(p_110669_2_, worldIn, acommandspreadplayers$position, p_110669_9_); notifyOperators(p_110669_1_, this, "commands.spreadplayers.success." + (p_110669_9_ ? "teams" : "players"), new Object[] {Integer.valueOf(acommandspreadplayers$position.length), Double.valueOf(p_110669_3_.field_111101_a), Double.valueOf(p_110669_3_.field_111100_b)}); if (acommandspreadplayers$position.length > 1) { p_110669_1_.addChatMessage(new ChatComponentTranslation("commands.spreadplayers.info." + (p_110669_9_ ? "teams" : "players"), new Object[] {String.format("%.2f", new Object[]{Double.valueOf(d4)}), Integer.valueOf(i)})); } }
/** * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination */ public void onDisconnect(IChatComponent reason) { logger.info(this.playerEntity.getName() + " lost connection: " + reason); this.serverController.refreshStatusNextTick(); ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("multiplayer.player.left", new Object[] {this.playerEntity.getDisplayName()}); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.YELLOW); this.serverController.getConfigurationManager().sendChatMsg(chatcomponenttranslation); this.playerEntity.mountEntityAndWakeUp(); this.serverController.getConfigurationManager().playerLoggedOut(this.playerEntity); if (this.serverController.isSinglePlayer() && this.playerEntity.getName().equals(this.serverController.getServerOwner())) { logger.info("Stopping singleplayer server as player logged out"); this.serverController.initiateShutdown(); } }
/** * Sends a message to the player reminding them that this is the demo version */ private void sendDemoReminder() { if (this.field_73104_e > 100) { this.thisPlayerMP.addChatMessage(new ChatComponentTranslation("demo.reminder", new Object[0])); this.field_73104_e = 0; } }
/** * Displays the GUI for interacting with a chest inventory. Args: chestInventory */ public void displayGUIChest(IInventory chestInventory) { if (this.openContainer != this.inventoryContainer) { this.closeScreen(); } if (chestInventory instanceof ILockableContainer) { ILockableContainer ilockablecontainer = (ILockableContainer)chestInventory; if (ilockablecontainer.isLocked() && !this.canOpen(ilockablecontainer.getLockCode()) && !this.isSpectator()) { this.playerNetServerHandler.sendPacket(new S02PacketChat(new ChatComponentTranslation("container.isLocked", new Object[] {chestInventory.getDisplayName()}), (byte)2)); this.playerNetServerHandler.sendPacket(new S29PacketSoundEffect("random.door_close", this.posX, this.posY, this.posZ, 1.0F, 1.0F)); return; } } this.getNextWindowId(); if (chestInventory instanceof IInteractionObject) { this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getDisplayName(), chestInventory.getSizeInventory())); this.openContainer = ((IInteractionObject)chestInventory).createContainer(this.inventory, this); } else { this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:container", chestInventory.getDisplayName(), chestInventory.getSizeInventory())); this.openContainer = new ContainerChest(this.inventory, chestInventory, this); } this.openContainer.windowId = this.currentWindowId; this.openContainer.onCraftGuiOpened(this); }
protected void listPlayers(ICommandSender p_147195_1_, String[] p_147195_2_, int p_147195_3_) throws CommandException { Scoreboard scoreboard = this.getScoreboard(); if (p_147195_2_.length > p_147195_3_) { String s = getEntityName(p_147195_1_, p_147195_2_[p_147195_3_]); Map<ScoreObjective, Score> map = scoreboard.getObjectivesForEntity(s); p_147195_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, map.size()); if (map.size() <= 0) { throw new CommandException("commands.scoreboard.players.list.player.empty", new Object[] {s}); } ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.scoreboard.players.list.player.count", new Object[] {Integer.valueOf(map.size()), s}); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); p_147195_1_.addChatMessage(chatcomponenttranslation); for (Score score : map.values()) { p_147195_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.players.list.player.entry", new Object[] {Integer.valueOf(score.getScorePoints()), score.getObjective().getDisplayName(), score.getObjective().getName()})); } } else { Collection<String> collection = scoreboard.getObjectiveNames(); p_147195_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection.size()); if (collection.size() <= 0) { throw new CommandException("commands.scoreboard.players.list.empty", new Object[0]); } ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.scoreboard.players.list.count", new Object[] {Integer.valueOf(collection.size())}); chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); p_147195_1_.addChatMessage(chatcomponenttranslation1); p_147195_1_.addChatMessage(new ChatComponentText(joinNiceString(collection.toArray()))); } }
/** * Callback when the command is invoked */ public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length >= 1 && args[0].equalsIgnoreCase("ips")) { sender.addChatMessage(new ChatComponentTranslation("commands.banlist.ips", new Object[] {Integer.valueOf(MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getKeys().length)})); sender.addChatMessage(new ChatComponentText(joinNiceString(MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getKeys()))); } else { sender.addChatMessage(new ChatComponentTranslation("commands.banlist.players", new Object[] {Integer.valueOf(MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().getKeys().length)})); sender.addChatMessage(new ChatComponentText(joinNiceString(MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().getKeys()))); } }
/** * Initializes statistics related to craftable items. Is only called after both block and item stats have been * initialized. */ private static void initCraftableStats() { Set<Item> set = Sets.<Item>newHashSet(); for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) { if (irecipe.getRecipeOutput() != null) { set.add(irecipe.getRecipeOutput().getItem()); } } for (ItemStack itemstack : FurnaceRecipes.instance().getSmeltingList().values()) { set.add(itemstack.getItem()); } for (Item item : set) { if (item != null) { int i = Item.getIdFromItem(item); String s = func_180204_a(item); if (s != null) { objectCraftStats[i] = (new StatCrafting("stat.craftItem.", s, new ChatComponentTranslation("stat.craftItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat(); } } } replaceAllSimilarBlocks(objectCraftStats); }
/** * 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}); } } }
/** * Callback when the command is invoked */ public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length > 0 && args[0].length() > 0) { IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 0, true); MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.announcement", new Object[] {sender.getDisplayName(), ichatcomponent})); } else { throw new WrongUsageException("commands.say.usage", new Object[0]); } }
public Achievement(String p_i45302_1_, String p_i45302_2_, int column, int row, ItemStack p_i45302_5_, Achievement parent) { super(p_i45302_1_, new ChatComponentTranslation("achievement." + p_i45302_2_, new Object[0])); this.theItemStack = p_i45302_5_; this.achievementDescription = "achievement." + p_i45302_2_ + ".desc"; this.displayColumn = column; this.displayRow = row; if (column < AchievementList.minDisplayColumn) { AchievementList.minDisplayColumn = column; } if (row < AchievementList.minDisplayRow) { AchievementList.minDisplayRow = row; } if (column > AchievementList.maxDisplayColumn) { AchievementList.maxDisplayColumn = column; } if (row > AchievementList.maxDisplayRow) { AchievementList.maxDisplayRow = row; } this.parentAchievement = parent; }
protected boolean tryExecute(ICommandSender sender, String[] args, ICommand command, String input) { try { command.processCommand(sender, args); return true; } catch (WrongUsageException wrongusageexception) { ChatComponentTranslation chatcomponenttranslation2 = new ChatComponentTranslation("commands.generic.usage", new Object[] {new ChatComponentTranslation(wrongusageexception.getMessage(), wrongusageexception.getErrorObjects())}); chatcomponenttranslation2.getChatStyle().setColor(EnumChatFormatting.RED); sender.addChatMessage(chatcomponenttranslation2); } catch (CommandException commandexception) { ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects()); chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.RED); sender.addChatMessage(chatcomponenttranslation1); } catch (Throwable var9) { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.exception", new Object[0]); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); sender.addChatMessage(chatcomponenttranslation); logger.warn("Couldn\'t process command: \'" + input + "\'"); } return false; }
/** * Callback when the command is invoked */ public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length <= 0) { throw new WrongUsageException("commands.defaultgamemode.usage", new Object[0]); } else { WorldSettings.GameType worldsettings$gametype = this.getGameModeFromCommand(sender, args[0]); this.setGameType(worldsettings$gametype); notifyOperators(sender, this, "commands.defaultgamemode.success", new Object[] {new ChatComponentTranslation("gameMode." + worldsettings$gametype.getName(), new Object[0])}); } }
/** * 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); } } }
/** * Callback when the command is invoked */ public void processCommand(ICommandSender sender, String[] args) throws CommandException { int i = MinecraftServer.getServer().getCurrentPlayerCount(); sender.addChatMessage(new ChatComponentTranslation("commands.players.list", new Object[] {Integer.valueOf(i), Integer.valueOf(MinecraftServer.getServer().getMaxPlayers())})); sender.addChatMessage(new ChatComponentText(MinecraftServer.getServer().getConfigurationManager().func_181058_b(args.length > 0 && "uuids".equalsIgnoreCase(args[0])))); sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, i); }
/** * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the * window resizes, the buttonList is cleared beforehand. */ public void initGui() { if (this.field_152323_r.isEmpty()) { this.field_152323_r.addAll(this.fontRendererObj.listFormattedStringToWidth(this.field_152326_h.func_152561_a().getFormattedText(), (int)((float)this.width * 0.75F))); if (this.field_152327_i != null) { this.field_152323_r.add(""); for (ChatComponentTranslation chatcomponenttranslation : this.field_152327_i) { this.field_152323_r.add(chatcomponenttranslation.getUnformattedTextForChat()); } } } if (this.field_152326_h.func_152559_b() != null) { this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 50, 150, 20, I18n.format("gui.cancel", new Object[0]))); this.buttonList.add(new GuiButton(1, this.width / 2 - 155 + 160, this.height - 50, 150, 20, I18n.format(this.field_152326_h.func_152559_b().getFormattedText(), new Object[0]))); } else { this.buttonList.add(new GuiButton(0, this.width / 2 - 75, this.height - 50, 150, 20, I18n.format("gui.cancel", new Object[0]))); } }
/** * Callback when the command is invoked */ public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length <= 0) { throw new WrongUsageException("commands.me.usage", new Object[0]); } else { IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 0, !(sender instanceof EntityPlayer)); MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.emote", new Object[] {sender.getDisplayName(), ichatcomponent})); } }
public GuiStreamUnavailable(GuiScreen parentScreenIn, GuiStreamUnavailable.Reason p_i46311_2_, List<ChatComponentTranslation> p_i46311_3_) { this.field_152324_f = new ChatComponentTranslation("stream.unavailable.title", new Object[0]); this.field_152323_r = Lists.<String>newArrayList(); this.parentScreen = parentScreenIn; this.field_152326_h = p_i46311_2_; this.field_152327_i = p_i46311_3_; }