{"action":"created","comment":{"url":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls/comments/33885244","id":33885244,"diff_hunk":"@@ -0,0 +1,171 @@\n+/*\n+ * This file is part of SpongeAPI, licensed under the MIT License (MIT).\n+ *\n+ * Copyright (c) SpongePowered <https://www.spongepowered.org>\n+ * Copyright (c) contributors\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"Software\"), to deal\n+ * in the Software without restriction, including without limitation the rights\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ * copies of the Software, and to permit persons to whom the Software is\n+ * furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included in\n+ * all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+ * THE SOFTWARE.\n+ */\n+package org.spongepowered.common.command;\n+\n+import com.google.common.base.Optional;\n+import net.minecraft.command.ICommandSender;\n+import net.minecraft.util.Vec3;\n+import org.spongepowered.api.entity.Entity;\n+import org.spongepowered.api.service.permission.MemorySubjectData;\n+import org.spongepowered.api.service.permission.PermissionService;\n+import org.spongepowered.api.service.permission.SubjectCollection;\n+import org.spongepowered.api.service.permission.SubjectData;\n+import org.spongepowered.api.text.Text;\n+import org.spongepowered.api.text.sink.MessageSink;\n+import org.spongepowered.api.util.Tristate;\n+import org.spongepowered.api.util.command.CommandMapping;\n+import org.spongepowered.api.util.command.CommandSource;\n+import org.spongepowered.api.util.command.source.EntitySource;\n+import org.spongepowered.api.util.command.source.LocatedSource;\n+import org.spongepowered.api.world.Location;\n+import org.spongepowered.api.world.World;\n+import org.spongepowered.common.Sponge;\n+import org.spongepowered.common.interfaces.IMixinCommandSender;\n+import org.spongepowered.common.service.permission.SpongePermissionService;\n+import org.spongepowered.common.service.permission.base.SpongeSubject;\n+import org.spongepowered.common.text.SpongeTexts;\n+import org.spongepowered.common.util.VecHelper;\n+\n+public class WrapperCommandSource extends SpongeSubject implements CommandSource {\n+\n+    final ICommandSender sender;\n+    private final MemorySubjectData data;\n+\n+    private WrapperCommandSource(ICommandSender sender) {\n+        this.sender = sender;\n+        this.data = new MemorySubjectData(Sponge.getGame().getServiceManager().provide(PermissionService.class).get());","path":"src/main/java/org/spongepowered/common/command/WrapperCommandSource.java","position":58,"original_position":58,"commit_id":"49cf01eeb5fb7661394ce885fd04632b711b1e28","original_commit_id":"73de872e385d8747de59d2a9c0d8e0e46f40f653","user":{"login":"zml2008","id":629092,"avatar_url":"https://avatars.githubusercontent.com/u/629092?v=3","gravatar_id":"","url":"https://api.github.com/users/zml2008","html_url":"https://github.com/zml2008","followers_url":"https://api.github.com/users/zml2008/followers","following_url":"https://api.github.com/users/zml2008/following{/other_user}","gists_url":"https://api.github.com/users/zml2008/gists{/gist_id}","starred_url":"https://api.github.com/users/zml2008/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zml2008/subscriptions","organizations_url":"https://api.github.com/users/zml2008/orgs","repos_url":"https://api.github.com/users/zml2008/repos","events_url":"https://api.github.com/users/zml2008/events{/privacy}","received_events_url":"https://api.github.com/users/zml2008/received_events","type":"User","site_admin":false},"body":"I think it would be preferable to delegate to permissions plugins for this if possible (but have to figure out how to do identifiers, and an appropriate subject type (maybe `minecraft`?)).","created_at":"2015-07-04T06:41:37Z","updated_at":"2015-07-04T06:41:37Z","html_url":"https://github.com/SpongePowered/SpongeCommon/pull/80#discussion_r33885244","pull_request_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls/80","_links":{"self":{"href":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls/comments/33885244"},"html":{"href":"https://github.com/SpongePowered/SpongeCommon/pull/80#discussion_r33885244"},"pull_request":{"href":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls/80"}}},"pull_request":{"url":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls/80","id":39120557,"html_url":"https://github.com/SpongePowered/SpongeCommon/pull/80","diff_url":"https://github.com/SpongePowered/SpongeCommon/pull/80.diff","patch_url":"https://github.com/SpongePowered/SpongeCommon/pull/80.patch","issue_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues/80","number":80,"state":"open","locked":false,"title":"Expand the Command API. Implements SpongePowered/SpongeAPI#744","user":{"login":"JBYoshi","id":12983479,"avatar_url":"https://avatars.githubusercontent.com/u/12983479?v=3","gravatar_id":"","url":"https://api.github.com/users/JBYoshi","html_url":"https://github.com/JBYoshi","followers_url":"https://api.github.com/users/JBYoshi/followers","following_url":"https://api.github.com/users/JBYoshi/following{/other_user}","gists_url":"https://api.github.com/users/JBYoshi/gists{/gist_id}","starred_url":"https://api.github.com/users/JBYoshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JBYoshi/subscriptions","organizations_url":"https://api.github.com/users/JBYoshi/orgs","repos_url":"https://api.github.com/users/JBYoshi/repos","events_url":"https://api.github.com/users/JBYoshi/events{/privacy}","received_events_url":"https://api.github.com/users/JBYoshi/received_events","type":"User","site_admin":false},"body":"This pull request:\r\n- Implements SpongePowered/SpongeAPI#744\r\n- Adds `WrapperCommandSource` to provide a `CommandSource` for mod-provided `ICommandSender`s\r\n- Adds a /help command as Sponge uses its own command registering system which NMS doesn't know about\r\n- Adds `IMixinCommandSender` and `IMixinCommandSource` to allow separation of the `ICommandSender` and `CommandSource` objects (for example, `EntityMinecartCommandBlock` is the `CommandSource`, but an inner class is the `ICommandSender`)\r\n- Extracts names of inner classes used in commands to constants, to reduce work when updating MC versions\r\n- Adds `sponge.debug.hover-stacktrace` support to exceptions in `ICommand`s\r\n- Update permissions, descriptions, and help for NMS commands\r\n- Move code from multiple command source mixins into shared mixins\r\n\r\nNote: When I was implementing `PaginationBuilder.page()`, I found that it was easier to simply remove `IterablePagination` and just move `ListPagination` into `ActivePagination`. Although it takes a bit more memory, it is easier both to code and to use.","created_at":"2015-07-02T20:03:36Z","updated_at":"2015-07-04T06:41:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a25fab1db3182aa2411ae349e13125139d584b0a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls/80/commits","review_comments_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls/80/comments","review_comment_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues/80/comments","statuses_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/statuses/49cf01eeb5fb7661394ce885fd04632b711b1e28","head":{"label":"JBYoshi:impl/commands","ref":"impl/commands","sha":"49cf01eeb5fb7661394ce885fd04632b711b1e28","user":{"login":"JBYoshi","id":12983479,"avatar_url":"https://avatars.githubusercontent.com/u/12983479?v=3","gravatar_id":"","url":"https://api.github.com/users/JBYoshi","html_url":"https://github.com/JBYoshi","followers_url":"https://api.github.com/users/JBYoshi/followers","following_url":"https://api.github.com/users/JBYoshi/following{/other_user}","gists_url":"https://api.github.com/users/JBYoshi/gists{/gist_id}","starred_url":"https://api.github.com/users/JBYoshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JBYoshi/subscriptions","organizations_url":"https://api.github.com/users/JBYoshi/orgs","repos_url":"https://api.github.com/users/JBYoshi/repos","events_url":"https://api.github.com/users/JBYoshi/events{/privacy}","received_events_url":"https://api.github.com/users/JBYoshi/received_events","type":"User","site_admin":false},"repo":{"id":37821950,"name":"SpongeCommon","full_name":"JBYoshi/SpongeCommon","owner":{"login":"JBYoshi","id":12983479,"avatar_url":"https://avatars.githubusercontent.com/u/12983479?v=3","gravatar_id":"","url":"https://api.github.com/users/JBYoshi","html_url":"https://github.com/JBYoshi","followers_url":"https://api.github.com/users/JBYoshi/followers","following_url":"https://api.github.com/users/JBYoshi/following{/other_user}","gists_url":"https://api.github.com/users/JBYoshi/gists{/gist_id}","starred_url":"https://api.github.com/users/JBYoshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JBYoshi/subscriptions","organizations_url":"https://api.github.com/users/JBYoshi/orgs","repos_url":"https://api.github.com/users/JBYoshi/repos","events_url":"https://api.github.com/users/JBYoshi/events{/privacy}","received_events_url":"https://api.github.com/users/JBYoshi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JBYoshi/SpongeCommon","description":"Shared code between Sponge and SpongeVanilla","fork":true,"url":"https://api.github.com/repos/JBYoshi/SpongeCommon","forks_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/forks","keys_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/teams","hooks_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/hooks","issue_events_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/issues/events{/number}","events_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/events","assignees_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/assignees{/user}","branches_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/branches{/branch}","tags_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/tags","blobs_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/git/refs{/sha}","trees_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/statuses/{sha}","languages_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/languages","stargazers_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/stargazers","contributors_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/contributors","subscribers_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/subscribers","subscription_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/subscription","commits_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/commits{/sha}","git_commits_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/git/commits{/sha}","comments_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/comments{/number}","issue_comment_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/issues/comments{/number}","contents_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/contents/{+path}","compare_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/merges","archive_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/downloads","issues_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/issues{/number}","pulls_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/pulls{/number}","milestones_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/milestones{/number}","notifications_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/labels{/name}","releases_url":"https://api.github.com/repos/JBYoshi/SpongeCommon/releases{/id}","created_at":"2015-06-21T19:08:45Z","updated_at":"2015-06-21T19:08:47Z","pushed_at":"2015-07-04T01:37:06Z","git_url":"git://github.com/JBYoshi/SpongeCommon.git","ssh_url":"git@github.com:JBYoshi/SpongeCommon.git","clone_url":"https://github.com/JBYoshi/SpongeCommon.git","svn_url":"https://github.com/JBYoshi/SpongeCommon","homepage":null,"size":1706,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"SpongePowered:master","ref":"master","sha":"751e604597245a0b1c0807766a4d17a57269668b","user":{"login":"SpongePowered","id":8683473,"avatar_url":"https://avatars.githubusercontent.com/u/8683473?v=3","gravatar_id":"","url":"https://api.github.com/users/SpongePowered","html_url":"https://github.com/SpongePowered","followers_url":"https://api.github.com/users/SpongePowered/followers","following_url":"https://api.github.com/users/SpongePowered/following{/other_user}","gists_url":"https://api.github.com/users/SpongePowered/gists{/gist_id}","starred_url":"https://api.github.com/users/SpongePowered/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpongePowered/subscriptions","organizations_url":"https://api.github.com/users/SpongePowered/orgs","repos_url":"https://api.github.com/users/SpongePowered/repos","events_url":"https://api.github.com/users/SpongePowered/events{/privacy}","received_events_url":"https://api.github.com/users/SpongePowered/received_events","type":"Organization","site_admin":false},"repo":{"id":33791453,"name":"SpongeCommon","full_name":"SpongePowered/SpongeCommon","owner":{"login":"SpongePowered","id":8683473,"avatar_url":"https://avatars.githubusercontent.com/u/8683473?v=3","gravatar_id":"","url":"https://api.github.com/users/SpongePowered","html_url":"https://github.com/SpongePowered","followers_url":"https://api.github.com/users/SpongePowered/followers","following_url":"https://api.github.com/users/SpongePowered/following{/other_user}","gists_url":"https://api.github.com/users/SpongePowered/gists{/gist_id}","starred_url":"https://api.github.com/users/SpongePowered/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpongePowered/subscriptions","organizations_url":"https://api.github.com/users/SpongePowered/orgs","repos_url":"https://api.github.com/users/SpongePowered/repos","events_url":"https://api.github.com/users/SpongePowered/events{/privacy}","received_events_url":"https://api.github.com/users/SpongePowered/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SpongePowered/SpongeCommon","description":"Shared code between Sponge and SpongeVanilla","fork":false,"url":"https://api.github.com/repos/SpongePowered/SpongeCommon","forks_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/forks","keys_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/teams","hooks_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/hooks","issue_events_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues/events{/number}","events_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/events","assignees_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/assignees{/user}","branches_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/branches{/branch}","tags_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/tags","blobs_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/git/refs{/sha}","trees_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/statuses/{sha}","languages_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/languages","stargazers_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/stargazers","contributors_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/contributors","subscribers_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/subscribers","subscription_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/subscription","commits_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/commits{/sha}","git_commits_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/git/commits{/sha}","comments_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/comments{/number}","issue_comment_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues/comments{/number}","contents_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/contents/{+path}","compare_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/merges","archive_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/downloads","issues_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues{/number}","pulls_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls{/number}","milestones_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/milestones{/number}","notifications_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/labels{/name}","releases_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/releases{/id}","created_at":"2015-04-11T20:38:48Z","updated_at":"2015-07-03T19:53:37Z","pushed_at":"2015-07-04T01:37:06Z","git_url":"git://github.com/SpongePowered/SpongeCommon.git","ssh_url":"git@github.com:SpongePowered/SpongeCommon.git","clone_url":"https://github.com/SpongePowered/SpongeCommon.git","svn_url":"https://github.com/SpongePowered/SpongeCommon","homepage":null,"size":3747,"stargazers_count":31,"watchers_count":31,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":24,"forks":24,"open_issues":24,"watchers":31,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls/80"},"html":{"href":"https://github.com/SpongePowered/SpongeCommon/pull/80"},"issue":{"href":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues/80"},"comments":{"href":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues/80/comments"},"review_comments":{"href":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls/80/comments"},"review_comment":{"href":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SpongePowered/SpongeCommon/pulls/80/commits"},"statuses":{"href":"https://api.github.com/repos/SpongePowered/SpongeCommon/statuses/49cf01eeb5fb7661394ce885fd04632b711b1e28"}}}}