@SuppressWarnings("incomplete-switch") public void handleTitle(S45PacketTitle packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); S45PacketTitle.Type s45packettitle$type = packetIn.getType(); String s = null; String s1 = null; String s2 = packetIn.getMessage() != null ? packetIn.getMessage().getFormattedText() : ""; switch (s45packettitle$type) { case TITLE: s = s2; break; case SUBTITLE: s1 = s2; break; case RESET: this.gameController.ingameGUI.displayTitle("", "", -1, -1, -1); this.gameController.ingameGUI.func_175177_a(); return; } this.gameController.ingameGUI.displayTitle(s, s1, packetIn.getFadeInTime(), packetIn.getDisplayTime(), packetIn.getFadeOutTime()); }
@Override public void showTitle(ChatComponent title, ChatComponent subtitle) { if (title != null) { this.playerNetServerHandler.sendPacket(new S45PacketTitle(S45PacketTitle.Type.TITLE, (IChatComponent) title)); if (subtitle != null) { this.playerNetServerHandler.sendPacket(new S45PacketTitle(S45PacketTitle.Type.SUBTITLE, (IChatComponent) subtitle)); } } }
@Override public void displayTitle(@Nonnull TitleMessage title) { IChatComponent main = (title.getTitle() != null && title.getTitle().length != 0) ? IChatComponent.Serializer.jsonToComponent(ComponentSerializer.toString(title.getTitle())) : null; IChatComponent sub = (title.getSubtitle() != null && title.getSubtitle().length != 0) ? IChatComponent.Serializer.jsonToComponent(ComponentSerializer.toString(title.getSubtitle())) : null; sendPacket(new S45PacketTitle(title.getFadeInTime(), title.getDisplayTime(), title.getFadeOutTime())); if(main != null){ this.sendPacket(new S45PacketTitle(S45PacketTitle.Type.TITLE, main)); } if(sub != null){ this.sendPacket(new S45PacketTitle(S45PacketTitle.Type.SUBTITLE, sub)); } }
/** * Callback when the command is invoked */ public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length < 2) { throw new WrongUsageException("commands.title.usage", new Object[0]); } else { if (args.length < 3) { if ("title".equals(args[1]) || "subtitle".equals(args[1])) { throw new WrongUsageException("commands.title.usage.title", new Object[0]); } if ("times".equals(args[1])) { throw new WrongUsageException("commands.title.usage.times", new Object[0]); } } EntityPlayerMP entityplayermp = getPlayer(sender, args[0]); S45PacketTitle.Type s45packettitle$type = S45PacketTitle.Type.byName(args[1]); if (s45packettitle$type != S45PacketTitle.Type.CLEAR && s45packettitle$type != S45PacketTitle.Type.RESET) { if (s45packettitle$type == S45PacketTitle.Type.TIMES) { if (args.length != 5) { throw new WrongUsageException("commands.title.usage", new Object[0]); } else { int i = parseInt(args[2]); int j = parseInt(args[3]); int k = parseInt(args[4]); S45PacketTitle s45packettitle2 = new S45PacketTitle(i, j, k); entityplayermp.playerNetServerHandler.sendPacket(s45packettitle2); notifyOperators(sender, this, "commands.title.success", new Object[0]); } } else if (args.length < 3) { throw new WrongUsageException("commands.title.usage", new Object[0]); } else { String s = buildString(args, 2); IChatComponent ichatcomponent; try { ichatcomponent = IChatComponent.Serializer.jsonToComponent(s); } catch (JsonParseException jsonparseexception) { Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception); throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()}); } S45PacketTitle s45packettitle1 = new S45PacketTitle(s45packettitle$type, ChatComponentProcessor.processComponent(sender, ichatcomponent, entityplayermp)); entityplayermp.playerNetServerHandler.sendPacket(s45packettitle1); notifyOperators(sender, this, "commands.title.success", new Object[0]); } } else if (args.length != 2) { throw new WrongUsageException("commands.title.usage", new Object[0]); } else { S45PacketTitle s45packettitle = new S45PacketTitle(s45packettitle$type, (IChatComponent)null); entityplayermp.playerNetServerHandler.sendPacket(s45packettitle); notifyOperators(sender, this, "commands.title.success", new Object[0]); } } }
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : (args.length == 2 ? getListOfStringsMatchingLastWord(args, S45PacketTitle.Type.getNames()) : null); }
@Override public void clearTitle() { this.sendPacket(new S45PacketTitle(S45PacketTitle.Type.CLEAR, null)); }
void handleTitle(S45PacketTitle packetIn);