{"action":"created","comment":{"url":"https://api.github.com/repos/Nukkit/Nukkit/pulls/comments/106805433","pull_request_review_id":27746821,"id":106805433,"diff_hunk":"@@ -0,0 +1,111 @@\n+package cn.nukkit.item;\n+\n+import cn.nukkit.Player;\n+import cn.nukkit.block.Block;\n+import cn.nukkit.level.Level;\n+import cn.nukkit.nbt.tag.CompoundTag;\n+import cn.nukkit.network.protocol.ClientboundMapItemDataPacket;\n+import cn.nukkit.utils.MainLogger;\n+\n+import javax.imageio.ImageIO;\n+import java.awt.*;\n+import java.awt.image.BufferedImage;\n+import java.io.ByteArrayInputStream;\n+import java.io.ByteArrayOutputStream;\n+import java.io.IOException;\n+\n+/**\n+ * Created by CreeperFace on 18.3.2017.\n+ */\n+public class ItemMap extends Item {\n+\n+    public static int mapCount = 0;\n+\n+    public ItemMap() {\n+        this(0, 1);\n+    }\n+\n+    public ItemMap(Integer meta) {\n+        this(meta, 1);\n+    }\n+\n+    public ItemMap(Integer meta, int count) {\n+        super(MAP, 0, count, \"Map\");\n+\n+        if (!hasCompoundTag() || !getNamedTag().contains(\"map_uuid\")) {\n+            CompoundTag tag = new CompoundTag();\n+            tag.putString(\"map_uuid\", \"\" + mapCount++);\n+            this.setNamedTag(tag);\n+        }\n+    }\n+\n+    public void setImage(BufferedImage img) {\n+        try {\n+            BufferedImage image = img;\n+\n+            if (img.getHeight() != 128 || img.getWidth() != 128) { //resize\n+                image = new BufferedImage(128, 128, img.getType());\n+                Graphics2D g = image.createGraphics();\n+                g.drawImage(img, 0, 0, 128, 128, null);\n+                g.dispose();\n+            }\n+\n+            ByteArrayOutputStream baos = new ByteArrayOutputStream();\n+            ImageIO.write(image, \"png\", baos);","path":"src/main/java/cn/nukkit/item/ItemMap.java","position":54,"original_position":54,"commit_id":"405bdba77b3376b82af8b72122dff1a9a89deeaf","original_commit_id":"405bdba77b3376b82af8b72122dff1a9a89deeaf","user":{"login":"NycuRO","id":13573011,"avatar_url":"https://avatars2.githubusercontent.com/u/13573011?v=3","gravatar_id":"","url":"https://api.github.com/users/NycuRO","html_url":"https://github.com/NycuRO","followers_url":"https://api.github.com/users/NycuRO/followers","following_url":"https://api.github.com/users/NycuRO/following{/other_user}","gists_url":"https://api.github.com/users/NycuRO/gists{/gist_id}","starred_url":"https://api.github.com/users/NycuRO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NycuRO/subscriptions","organizations_url":"https://api.github.com/users/NycuRO/orgs","repos_url":"https://api.github.com/users/NycuRO/repos","events_url":"https://api.github.com/users/NycuRO/events{/privacy}","received_events_url":"https://api.github.com/users/NycuRO/received_events","type":"User","site_admin":false},"body":"@vzlomka76 Ok, and what event need use?\r\n\r\nAnd in \"filewithimage\" need add directory ? Example: /root/server/image.gif?","created_at":"2017-03-19T12:33:43Z","updated_at":"2017-03-19T12:33:43Z","html_url":"https://github.com/Nukkit/Nukkit/pull/1545#discussion_r106805433","pull_request_url":"https://api.github.com/repos/Nukkit/Nukkit/pulls/1545","_links":{"self":{"href":"https://api.github.com/repos/Nukkit/Nukkit/pulls/comments/106805433"},"html":{"href":"https://github.com/Nukkit/Nukkit/pull/1545#discussion_r106805433"},"pull_request":{"href":"https://api.github.com/repos/Nukkit/Nukkit/pulls/1545"}}},"pull_request":{"url":"https://api.github.com/repos/Nukkit/Nukkit/pulls/1545","id":111439407,"html_url":"https://github.com/Nukkit/Nukkit/pull/1545","diff_url":"https://github.com/Nukkit/Nukkit/pull/1545.diff","patch_url":"https://github.com/Nukkit/Nukkit/pull/1545.patch","issue_url":"https://api.github.com/repos/Nukkit/Nukkit/issues/1545","number":1545,"state":"open","locked":false,"title":"Added basic map API","user":{"login":"Creeperface01","id":10363500,"avatar_url":"https://avatars1.githubusercontent.com/u/10363500?v=3","gravatar_id":"","url":"https://api.github.com/users/Creeperface01","html_url":"https://github.com/Creeperface01","followers_url":"https://api.github.com/users/Creeperface01/followers","following_url":"https://api.github.com/users/Creeperface01/following{/other_user}","gists_url":"https://api.github.com/users/Creeperface01/gists{/gist_id}","starred_url":"https://api.github.com/users/Creeperface01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Creeperface01/subscriptions","organizations_url":"https://api.github.com/users/Creeperface01/orgs","repos_url":"https://api.github.com/users/Creeperface01/repos","events_url":"https://api.github.com/users/Creeperface01/events{/privacy}","received_events_url":"https://api.github.com/users/Creeperface01/received_events","type":"User","site_admin":false},"body":"I also added some map saving, I know its bad, but idk how to save in, because map data are long array and we need byte array. But it works. The only problem is when player take the map item from item frame and pickup it, because it throws EOF exception, idk if maybe player sends bad comppound tag","created_at":"2017-03-19T06:47:06Z","updated_at":"2017-03-19T12:33:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a1dc15fc4abcd4a8ae4fb47e3775f45f3b49357c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Nukkit/Nukkit/pulls/1545/commits","review_comments_url":"https://api.github.com/repos/Nukkit/Nukkit/pulls/1545/comments","review_comment_url":"https://api.github.com/repos/Nukkit/Nukkit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Nukkit/Nukkit/issues/1545/comments","statuses_url":"https://api.github.com/repos/Nukkit/Nukkit/statuses/405bdba77b3376b82af8b72122dff1a9a89deeaf","head":{"label":"Creeperface01:map","ref":"map","sha":"405bdba77b3376b82af8b72122dff1a9a89deeaf","user":{"login":"Creeperface01","id":10363500,"avatar_url":"https://avatars1.githubusercontent.com/u/10363500?v=3","gravatar_id":"","url":"https://api.github.com/users/Creeperface01","html_url":"https://github.com/Creeperface01","followers_url":"https://api.github.com/users/Creeperface01/followers","following_url":"https://api.github.com/users/Creeperface01/following{/other_user}","gists_url":"https://api.github.com/users/Creeperface01/gists{/gist_id}","starred_url":"https://api.github.com/users/Creeperface01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Creeperface01/subscriptions","organizations_url":"https://api.github.com/users/Creeperface01/orgs","repos_url":"https://api.github.com/users/Creeperface01/repos","events_url":"https://api.github.com/users/Creeperface01/events{/privacy}","received_events_url":"https://api.github.com/users/Creeperface01/received_events","type":"User","site_admin":false},"repo":{"id":85423261,"name":"Nukkit","full_name":"Creeperface01/Nukkit","owner":{"login":"Creeperface01","id":10363500,"avatar_url":"https://avatars1.githubusercontent.com/u/10363500?v=3","gravatar_id":"","url":"https://api.github.com/users/Creeperface01","html_url":"https://github.com/Creeperface01","followers_url":"https://api.github.com/users/Creeperface01/followers","following_url":"https://api.github.com/users/Creeperface01/following{/other_user}","gists_url":"https://api.github.com/users/Creeperface01/gists{/gist_id}","starred_url":"https://api.github.com/users/Creeperface01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Creeperface01/subscriptions","organizations_url":"https://api.github.com/users/Creeperface01/orgs","repos_url":"https://api.github.com/users/Creeperface01/repos","events_url":"https://api.github.com/users/Creeperface01/events{/privacy}","received_events_url":"https://api.github.com/users/Creeperface01/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Creeperface01/Nukkit","description":"Nukkit is a Nuclear-Powered Server Software For Minecraft: Pocket Edition","fork":true,"url":"https://api.github.com/repos/Creeperface01/Nukkit","forks_url":"https://api.github.com/repos/Creeperface01/Nukkit/forks","keys_url":"https://api.github.com/repos/Creeperface01/Nukkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Creeperface01/Nukkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Creeperface01/Nukkit/teams","hooks_url":"https://api.github.com/repos/Creeperface01/Nukkit/hooks","issue_events_url":"https://api.github.com/repos/Creeperface01/Nukkit/issues/events{/number}","events_url":"https://api.github.com/repos/Creeperface01/Nukkit/events","assignees_url":"https://api.github.com/repos/Creeperface01/Nukkit/assignees{/user}","branches_url":"https://api.github.com/repos/Creeperface01/Nukkit/branches{/branch}","tags_url":"https://api.github.com/repos/Creeperface01/Nukkit/tags","blobs_url":"https://api.github.com/repos/Creeperface01/Nukkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Creeperface01/Nukkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Creeperface01/Nukkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/Creeperface01/Nukkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Creeperface01/Nukkit/statuses/{sha}","languages_url":"https://api.github.com/repos/Creeperface01/Nukkit/languages","stargazers_url":"https://api.github.com/repos/Creeperface01/Nukkit/stargazers","contributors_url":"https://api.github.com/repos/Creeperface01/Nukkit/contributors","subscribers_url":"https://api.github.com/repos/Creeperface01/Nukkit/subscribers","subscription_url":"https://api.github.com/repos/Creeperface01/Nukkit/subscription","commits_url":"https://api.github.com/repos/Creeperface01/Nukkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/Creeperface01/Nukkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/Creeperface01/Nukkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/Creeperface01/Nukkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/Creeperface01/Nukkit/contents/{+path}","compare_url":"https://api.github.com/repos/Creeperface01/Nukkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Creeperface01/Nukkit/merges","archive_url":"https://api.github.com/repos/Creeperface01/Nukkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Creeperface01/Nukkit/downloads","issues_url":"https://api.github.com/repos/Creeperface01/Nukkit/issues{/number}","pulls_url":"https://api.github.com/repos/Creeperface01/Nukkit/pulls{/number}","milestones_url":"https://api.github.com/repos/Creeperface01/Nukkit/milestones{/number}","notifications_url":"https://api.github.com/repos/Creeperface01/Nukkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Creeperface01/Nukkit/labels{/name}","releases_url":"https://api.github.com/repos/Creeperface01/Nukkit/releases{/id}","deployments_url":"https://api.github.com/repos/Creeperface01/Nukkit/deployments","created_at":"2017-03-18T18:29:59Z","updated_at":"2017-03-18T18:30:02Z","pushed_at":"2017-03-19T06:49:16Z","git_url":"git://github.com/Creeperface01/Nukkit.git","ssh_url":"git@github.com:Creeperface01/Nukkit.git","clone_url":"https://github.com/Creeperface01/Nukkit.git","svn_url":"https://github.com/Creeperface01/Nukkit","homepage":"https://nukkit.io","size":10256,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Nukkit:master","ref":"master","sha":"0751e9b4698678cde41eaf70be840d584b2eaf2f","user":{"login":"Nukkit","id":12780190,"avatar_url":"https://avatars0.githubusercontent.com/u/12780190?v=3","gravatar_id":"","url":"https://api.github.com/users/Nukkit","html_url":"https://github.com/Nukkit","followers_url":"https://api.github.com/users/Nukkit/followers","following_url":"https://api.github.com/users/Nukkit/following{/other_user}","gists_url":"https://api.github.com/users/Nukkit/gists{/gist_id}","starred_url":"https://api.github.com/users/Nukkit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nukkit/subscriptions","organizations_url":"https://api.github.com/users/Nukkit/orgs","repos_url":"https://api.github.com/users/Nukkit/repos","events_url":"https://api.github.com/users/Nukkit/events{/privacy}","received_events_url":"https://api.github.com/users/Nukkit/received_events","type":"Organization","site_admin":false},"repo":{"id":36117051,"name":"Nukkit","full_name":"Nukkit/Nukkit","owner":{"login":"Nukkit","id":12780190,"avatar_url":"https://avatars0.githubusercontent.com/u/12780190?v=3","gravatar_id":"","url":"https://api.github.com/users/Nukkit","html_url":"https://github.com/Nukkit","followers_url":"https://api.github.com/users/Nukkit/followers","following_url":"https://api.github.com/users/Nukkit/following{/other_user}","gists_url":"https://api.github.com/users/Nukkit/gists{/gist_id}","starred_url":"https://api.github.com/users/Nukkit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nukkit/subscriptions","organizations_url":"https://api.github.com/users/Nukkit/orgs","repos_url":"https://api.github.com/users/Nukkit/repos","events_url":"https://api.github.com/users/Nukkit/events{/privacy}","received_events_url":"https://api.github.com/users/Nukkit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Nukkit/Nukkit","description":"Nukkit is a Nuclear-Powered Server Software For Minecraft: Pocket Edition","fork":false,"url":"https://api.github.com/repos/Nukkit/Nukkit","forks_url":"https://api.github.com/repos/Nukkit/Nukkit/forks","keys_url":"https://api.github.com/repos/Nukkit/Nukkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Nukkit/Nukkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Nukkit/Nukkit/teams","hooks_url":"https://api.github.com/repos/Nukkit/Nukkit/hooks","issue_events_url":"https://api.github.com/repos/Nukkit/Nukkit/issues/events{/number}","events_url":"https://api.github.com/repos/Nukkit/Nukkit/events","assignees_url":"https://api.github.com/repos/Nukkit/Nukkit/assignees{/user}","branches_url":"https://api.github.com/repos/Nukkit/Nukkit/branches{/branch}","tags_url":"https://api.github.com/repos/Nukkit/Nukkit/tags","blobs_url":"https://api.github.com/repos/Nukkit/Nukkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Nukkit/Nukkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Nukkit/Nukkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/Nukkit/Nukkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Nukkit/Nukkit/statuses/{sha}","languages_url":"https://api.github.com/repos/Nukkit/Nukkit/languages","stargazers_url":"https://api.github.com/repos/Nukkit/Nukkit/stargazers","contributors_url":"https://api.github.com/repos/Nukkit/Nukkit/contributors","subscribers_url":"https://api.github.com/repos/Nukkit/Nukkit/subscribers","subscription_url":"https://api.github.com/repos/Nukkit/Nukkit/subscription","commits_url":"https://api.github.com/repos/Nukkit/Nukkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/Nukkit/Nukkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/Nukkit/Nukkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/Nukkit/Nukkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/Nukkit/Nukkit/contents/{+path}","compare_url":"https://api.github.com/repos/Nukkit/Nukkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Nukkit/Nukkit/merges","archive_url":"https://api.github.com/repos/Nukkit/Nukkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Nukkit/Nukkit/downloads","issues_url":"https://api.github.com/repos/Nukkit/Nukkit/issues{/number}","pulls_url":"https://api.github.com/repos/Nukkit/Nukkit/pulls{/number}","milestones_url":"https://api.github.com/repos/Nukkit/Nukkit/milestones{/number}","notifications_url":"https://api.github.com/repos/Nukkit/Nukkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Nukkit/Nukkit/labels{/name}","releases_url":"https://api.github.com/repos/Nukkit/Nukkit/releases{/id}","deployments_url":"https://api.github.com/repos/Nukkit/Nukkit/deployments","created_at":"2015-05-23T09:51:41Z","updated_at":"2017-03-17T12:14:09Z","pushed_at":"2017-03-19T10:42:43Z","git_url":"git://github.com/Nukkit/Nukkit.git","ssh_url":"git@github.com:Nukkit/Nukkit.git","clone_url":"https://github.com/Nukkit/Nukkit.git","svn_url":"https://github.com/Nukkit/Nukkit","homepage":"https://nukkit.io","size":10258,"stargazers_count":407,"watchers_count":407,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":249,"mirror_url":null,"open_issues_count":56,"forks":249,"open_issues":56,"watchers":407,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Nukkit/Nukkit/pulls/1545"},"html":{"href":"https://github.com/Nukkit/Nukkit/pull/1545"},"issue":{"href":"https://api.github.com/repos/Nukkit/Nukkit/issues/1545"},"comments":{"href":"https://api.github.com/repos/Nukkit/Nukkit/issues/1545/comments"},"review_comments":{"href":"https://api.github.com/repos/Nukkit/Nukkit/pulls/1545/comments"},"review_comment":{"href":"https://api.github.com/repos/Nukkit/Nukkit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Nukkit/Nukkit/pulls/1545/commits"},"statuses":{"href":"https://api.github.com/repos/Nukkit/Nukkit/statuses/405bdba77b3376b82af8b72122dff1a9a89deeaf"}}}}
{"actor":{"display_login":"NycuRO"}}