{"action":"created","issue":{"url":"https://api.github.com/repos/SpigotMC/BungeeCord/issues/2436","repository_url":"https://api.github.com/repos/SpigotMC/BungeeCord","labels_url":"https://api.github.com/repos/SpigotMC/BungeeCord/issues/2436/labels{/name}","comments_url":"https://api.github.com/repos/SpigotMC/BungeeCord/issues/2436/comments","events_url":"https://api.github.com/repos/SpigotMC/BungeeCord/issues/2436/events","html_url":"https://github.com/SpigotMC/BungeeCord/pull/2436","id":330915822,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzNzk0Mjkw","number":2436,"title":"Extend Chat module with Appender functional interface support","user":{"login":"JarvisCraft","id":7693005,"node_id":"MDQ6VXNlcjc2OTMwMDU=","avatar_url":"https://avatars3.githubusercontent.com/u/7693005?v=4","gravatar_id":"","url":"https://api.github.com/users/JarvisCraft","html_url":"https://github.com/JarvisCraft","followers_url":"https://api.github.com/users/JarvisCraft/followers","following_url":"https://api.github.com/users/JarvisCraft/following{/other_user}","gists_url":"https://api.github.com/users/JarvisCraft/gists{/gist_id}","starred_url":"https://api.github.com/users/JarvisCraft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JarvisCraft/subscriptions","organizations_url":"https://api.github.com/users/JarvisCraft/orgs","repos_url":"https://api.github.com/users/JarvisCraft/repos","events_url":"https://api.github.com/users/JarvisCraft/events{/privacy}","received_events_url":"https://api.github.com/users/JarvisCraft/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-06-09T20:09:11Z","updated_at":"2018-06-10T11:45:26Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/SpigotMC/BungeeCord/pulls/2436","html_url":"https://github.com/SpigotMC/BungeeCord/pull/2436","diff_url":"https://github.com/SpigotMC/BungeeCord/pull/2436.diff","patch_url":"https://github.com/SpigotMC/BungeeCord/pull/2436.patch"},"body":"Add support for functional interfaces in ComponentBuilder using inner Appender class which lets implement complex constructions without breaking chain pattern.\r\n\r\nFor example for method\r\n```Java\r\npublic ComponentBuilder appendAuthors(ComponentBuilder builder, JavaPlugin plugin) {\r\n    Iterable<String> authors = getDescription().getAuthors();\r\n    int lastIndex = authors.size() - 1;\r\n    for (var i = 0; i < authors.size(); i++) {\r\n        builder.append(authors.get(i)).color(AQUA);\r\n        if (i == lastIndex) continue;\r\n        builder.append(\" & \" ).color(WHITE);\r\n    }\r\n}\r\n```\r\nBefore:\r\n```Java\r\nappendAuthors(new ComponentBuilder(\"Game \").color(ChatColor.BLUE)\r\n        .append(\" by\").color(ChatColor.WHITE), plugin)\r\n.append(\" <3\").color(ChatColor.RED);\r\n```\r\nAfter:\r\n```Java\r\nnew ComponentBuilder(\"Game \").color(ChatColor.BLUE).append(\" by\").color(ChatColor.WHITE)\r\n.append(builder -> appendAuthors(builder, plugin)).append(\" <3\").color(ChatColor.RED);\r\n```\r\nThis may seem to be longer in some cases but helps avoid nesting statements in cases like \r\n```Java\r\nappendBaz(\r\n        appendBar(\r\n                appendFoo(new ComponentBuilder(\"Lorem\")/*appenders, colors and more*//*, fooParams*/)/*.append(...)..more appenders x1*//*, barParams*/\r\n        )/*.append(...)..more appenders x3*//*, bazParams*/\r\n)/*.append(...)..more appenders x3*/\r\n```"},"comment":{"url":"https://api.github.com/repos/SpigotMC/BungeeCord/issues/comments/396042588","html_url":"https://github.com/SpigotMC/BungeeCord/pull/2436#issuecomment-396042588","issue_url":"https://api.github.com/repos/SpigotMC/BungeeCord/issues/2436","id":396042588,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjA0MjU4OA==","user":{"login":"md-5","id":1007849,"node_id":"MDQ6VXNlcjEwMDc4NDk=","avatar_url":"https://avatars2.githubusercontent.com/u/1007849?v=4","gravatar_id":"","url":"https://api.github.com/users/md-5","html_url":"https://github.com/md-5","followers_url":"https://api.github.com/users/md-5/followers","following_url":"https://api.github.com/users/md-5/following{/other_user}","gists_url":"https://api.github.com/users/md-5/gists{/gist_id}","starred_url":"https://api.github.com/users/md-5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/md-5/subscriptions","organizations_url":"https://api.github.com/users/md-5/orgs","repos_url":"https://api.github.com/users/md-5/repos","events_url":"https://api.github.com/users/md-5/events{/privacy}","received_events_url":"https://api.github.com/users/md-5/received_events","type":"User","site_admin":false},"created_at":"2018-06-10T11:45:26Z","updated_at":"2018-06-10T11:45:26Z","author_association":"MEMBER","body":"I’m confused. Why not just make your example method return a BaseComponent instead?"}}
{"actor":{"display_login":"md-5"}}