{"action":"created","comment":{"url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments/118849549","pull_request_review_id":40680020,"id":118849549,"diff_hunk":"@@ -0,0 +1,120 @@\n+package com.minecolonies.coremod.commands.colonycommands;\n+\n+import com.minecolonies.api.colony.permissions.Rank;\n+import com.minecolonies.coremod.colony.Colony;\n+import com.minecolonies.coremod.colony.ColonyManager;\n+import com.minecolonies.coremod.colony.IColony;\n+import com.minecolonies.coremod.commands.AbstractSingleCommand;\n+import net.minecraft.command.CommandException;\n+import net.minecraft.command.ICommandSender;\n+import net.minecraft.entity.player.EntityPlayer;\n+import net.minecraft.server.MinecraftServer;\n+import net.minecraft.util.math.BlockPos;\n+import net.minecraft.util.text.TextComponentString;\n+import org.jetbrains.annotations.NotNull;\n+\n+import javax.annotation.Nullable;\n+import java.util.Collections;\n+import java.util.List;\n+\n+import static com.minecolonies.coremod.commands.AbstractSingleCommand.Commands.ADDOFFICER;\n+\n+/**\n+ * List all colonies.\n+ */\n+public class AddOfficerCommand extends AbstractSingleCommand\n+{\n+\n+    public static final  String       DESC            = \"addOfficer\";\n+    private static final String       SUCCESS_MESSAGE = \"Succesfully added Player %s to colony %d\";\n+    private static final String       COLONY_NULL     = \"Couldn't find colony %d.\";\n+    private static final String       NO_ARGUMENTS    = \"Please define a colony or player\";\n+\n+    /**\n+     * Initialize this SubCommand with it's parents.\n+     *\n+     * @param parents an array of all the parents.\n+     */\n+    public AddOfficerCommand(@NotNull final String... parents)\n+    {\n+        super(parents);\n+    }\n+\n+    @NotNull\n+    @Override\n+    public String getCommandUsage(@NotNull final ICommandSender sender)\n+    {\n+        return super.getCommandUsage(sender) + \"<ColonyId> <(Optional)Player>\";\n+    }\n+\n+    @Override\n+    public void execute(@NotNull final MinecraftServer server, @NotNull final ICommandSender sender, @NotNull final String... args) throws CommandException\n+    {\n+        if(args.length == 0)\n+        {\n+            sender.getCommandSenderEntity().sendMessage(new TextComponentString(NO_ARGUMENTS));\n+            return;\n+        }\n+\n+        int colonyId = getIthArgument(args, 0, -1);\n+        if(colonyId == -1 && sender instanceof EntityPlayer)\n+        {\n+            final IColony colony = ColonyManager.getIColonyByOwner(sender.getEntityWorld(), ((EntityPlayer) sender).getUniqueID());\n+            if(colony == null)\n+            {\n+                sender.getCommandSenderEntity().sendMessage(new TextComponentString(COLONY_NULL));\n+                return;\n+            }\n+            colonyId = colony.getID();\n+        }\n+\n+        final Colony colony = ColonyManager.getColony(colonyId);\n+\n+        if (colony == null)\n+        {\n+            sender.sendMessage(new TextComponentString(String.format(COLONY_NULL, colonyId)));\n+            return;\n+        }\n+\n+        if(sender instanceof EntityPlayer)\n+        {\n+            EntityPlayer player = (EntityPlayer) sender;\n+            if (!canPlayerUseCommand(player, ADDOFFICER, colonyId))\n+            {\n+                sender.getCommandSenderEntity().sendMessage(new TextComponentString(NOT_PERMITTED));\n+                return;\n+            }\n+        }\n+\n+        String playerName = null;\n+        if (args.length >= 2)","path":"src/main/java/com/minecolonies/coremod/commands/colonycommands/AddOfficerCommand.java","position":90,"original_position":90,"commit_id":"945b86d195fe355ee006c7c41de56eafe80af905","original_commit_id":"945b86d195fe355ee006c7c41de56eafe80af905","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars2.githubusercontent.com/u/19940114?v=3","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Avoid using Literals in Conditional Statements](https://www.codacy.com/app/Minecolonies/minecolonies/pullRequest?prid=673975)","created_at":"2017-05-28T21:09:33Z","updated_at":"2017-05-28T21:09:33Z","html_url":"https://github.com/Minecolonies/minecolonies/pull/1101#discussion_r118849549","pull_request_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1101","_links":{"self":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments/118849549"},"html":{"href":"https://github.com/Minecolonies/minecolonies/pull/1101#discussion_r118849549"},"pull_request":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1101"}}},"pull_request":{"url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1101","id":122763508,"html_url":"https://github.com/Minecolonies/minecolonies/pull/1101","diff_url":"https://github.com/Minecolonies/minecolonies/pull/1101.diff","patch_url":"https://github.com/Minecolonies/minecolonies/pull/1101.patch","issue_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/1101","number":1101,"state":"open","locked":false,"title":"port commands","user":{"login":"Raycoms","id":6438347,"avatar_url":"https://avatars2.githubusercontent.com/u/6438347?v=3","gravatar_id":"","url":"https://api.github.com/users/Raycoms","html_url":"https://github.com/Raycoms","followers_url":"https://api.github.com/users/Raycoms/followers","following_url":"https://api.github.com/users/Raycoms/following{/other_user}","gists_url":"https://api.github.com/users/Raycoms/gists{/gist_id}","starred_url":"https://api.github.com/users/Raycoms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Raycoms/subscriptions","organizations_url":"https://api.github.com/users/Raycoms/orgs","repos_url":"https://api.github.com/users/Raycoms/repos","events_url":"https://api.github.com/users/Raycoms/events{/privacy}","received_events_url":"https://api.github.com/users/Raycoms/received_events","type":"User","site_admin":false},"body":"\r\n# Changes proposed in this pull request:\r\n- Ports the abandoned colony changes to 1.11\r\n- Seems also to add some changes we have left behind before.\r\n\r\n\r\nReview please\r\n","created_at":"2017-05-27T14:49:59Z","updated_at":"2017-05-28T21:09:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fcaa539712fcffb6d9987ee8d0fdc951cda0d9d9","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1101/commits","review_comments_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1101/comments","review_comment_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/1101/comments","statuses_url":"https://api.github.com/repos/Minecolonies/minecolonies/statuses/945b86d195fe355ee006c7c41de56eafe80af905","head":{"label":"Minecolonies:port/1.10abandoned","ref":"port/1.10abandoned","sha":"945b86d195fe355ee006c7c41de56eafe80af905","user":{"login":"Minecolonies","id":5167336,"avatar_url":"https://avatars0.githubusercontent.com/u/5167336?v=3","gravatar_id":"","url":"https://api.github.com/users/Minecolonies","html_url":"https://github.com/Minecolonies","followers_url":"https://api.github.com/users/Minecolonies/followers","following_url":"https://api.github.com/users/Minecolonies/following{/other_user}","gists_url":"https://api.github.com/users/Minecolonies/gists{/gist_id}","starred_url":"https://api.github.com/users/Minecolonies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Minecolonies/subscriptions","organizations_url":"https://api.github.com/users/Minecolonies/orgs","repos_url":"https://api.github.com/users/Minecolonies/repos","events_url":"https://api.github.com/users/Minecolonies/events{/privacy}","received_events_url":"https://api.github.com/users/Minecolonies/received_events","type":"Organization","site_admin":false},"repo":{"id":65616760,"name":"minecolonies","full_name":"Minecolonies/minecolonies","owner":{"login":"Minecolonies","id":5167336,"avatar_url":"https://avatars0.githubusercontent.com/u/5167336?v=3","gravatar_id":"","url":"https://api.github.com/users/Minecolonies","html_url":"https://github.com/Minecolonies","followers_url":"https://api.github.com/users/Minecolonies/followers","following_url":"https://api.github.com/users/Minecolonies/following{/other_user}","gists_url":"https://api.github.com/users/Minecolonies/gists{/gist_id}","starred_url":"https://api.github.com/users/Minecolonies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Minecolonies/subscriptions","organizations_url":"https://api.github.com/users/Minecolonies/orgs","repos_url":"https://api.github.com/users/Minecolonies/repos","events_url":"https://api.github.com/users/Minecolonies/events{/privacy}","received_events_url":"https://api.github.com/users/Minecolonies/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Minecolonies/minecolonies","description":"Minecolonies minecraft mod","fork":false,"url":"https://api.github.com/repos/Minecolonies/minecolonies","forks_url":"https://api.github.com/repos/Minecolonies/minecolonies/forks","keys_url":"https://api.github.com/repos/Minecolonies/minecolonies/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Minecolonies/minecolonies/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Minecolonies/minecolonies/teams","hooks_url":"https://api.github.com/repos/Minecolonies/minecolonies/hooks","issue_events_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/events{/number}","events_url":"https://api.github.com/repos/Minecolonies/minecolonies/events","assignees_url":"https://api.github.com/repos/Minecolonies/minecolonies/assignees{/user}","branches_url":"https://api.github.com/repos/Minecolonies/minecolonies/branches{/branch}","tags_url":"https://api.github.com/repos/Minecolonies/minecolonies/tags","blobs_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/refs{/sha}","trees_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Minecolonies/minecolonies/statuses/{sha}","languages_url":"https://api.github.com/repos/Minecolonies/minecolonies/languages","stargazers_url":"https://api.github.com/repos/Minecolonies/minecolonies/stargazers","contributors_url":"https://api.github.com/repos/Minecolonies/minecolonies/contributors","subscribers_url":"https://api.github.com/repos/Minecolonies/minecolonies/subscribers","subscription_url":"https://api.github.com/repos/Minecolonies/minecolonies/subscription","commits_url":"https://api.github.com/repos/Minecolonies/minecolonies/commits{/sha}","git_commits_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/commits{/sha}","comments_url":"https://api.github.com/repos/Minecolonies/minecolonies/comments{/number}","issue_comment_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/comments{/number}","contents_url":"https://api.github.com/repos/Minecolonies/minecolonies/contents/{+path}","compare_url":"https://api.github.com/repos/Minecolonies/minecolonies/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Minecolonies/minecolonies/merges","archive_url":"https://api.github.com/repos/Minecolonies/minecolonies/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Minecolonies/minecolonies/downloads","issues_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues{/number}","pulls_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls{/number}","milestones_url":"https://api.github.com/repos/Minecolonies/minecolonies/milestones{/number}","notifications_url":"https://api.github.com/repos/Minecolonies/minecolonies/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Minecolonies/minecolonies/labels{/name}","releases_url":"https://api.github.com/repos/Minecolonies/minecolonies/releases{/id}","deployments_url":"https://api.github.com/repos/Minecolonies/minecolonies/deployments","created_at":"2016-08-13T12:45:38Z","updated_at":"2017-05-28T05:29:31Z","pushed_at":"2017-05-28T21:06:35Z","git_url":"git://github.com/Minecolonies/minecolonies.git","ssh_url":"git@github.com:Minecolonies/minecolonies.git","clone_url":"https://github.com/Minecolonies/minecolonies.git","svn_url":"https://github.com/Minecolonies/minecolonies","homepage":"http://minecolonies.com/","size":16643,"stargazers_count":40,"watchers_count":40,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":113,"forks":36,"open_issues":113,"watchers":40,"default_branch":"version/1.11"}},"base":{"label":"Minecolonies:version/1.11","ref":"version/1.11","sha":"98893751c9bb1c045de320e4a350fee1c0347bab","user":{"login":"Minecolonies","id":5167336,"avatar_url":"https://avatars0.githubusercontent.com/u/5167336?v=3","gravatar_id":"","url":"https://api.github.com/users/Minecolonies","html_url":"https://github.com/Minecolonies","followers_url":"https://api.github.com/users/Minecolonies/followers","following_url":"https://api.github.com/users/Minecolonies/following{/other_user}","gists_url":"https://api.github.com/users/Minecolonies/gists{/gist_id}","starred_url":"https://api.github.com/users/Minecolonies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Minecolonies/subscriptions","organizations_url":"https://api.github.com/users/Minecolonies/orgs","repos_url":"https://api.github.com/users/Minecolonies/repos","events_url":"https://api.github.com/users/Minecolonies/events{/privacy}","received_events_url":"https://api.github.com/users/Minecolonies/received_events","type":"Organization","site_admin":false},"repo":{"id":65616760,"name":"minecolonies","full_name":"Minecolonies/minecolonies","owner":{"login":"Minecolonies","id":5167336,"avatar_url":"https://avatars0.githubusercontent.com/u/5167336?v=3","gravatar_id":"","url":"https://api.github.com/users/Minecolonies","html_url":"https://github.com/Minecolonies","followers_url":"https://api.github.com/users/Minecolonies/followers","following_url":"https://api.github.com/users/Minecolonies/following{/other_user}","gists_url":"https://api.github.com/users/Minecolonies/gists{/gist_id}","starred_url":"https://api.github.com/users/Minecolonies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Minecolonies/subscriptions","organizations_url":"https://api.github.com/users/Minecolonies/orgs","repos_url":"https://api.github.com/users/Minecolonies/repos","events_url":"https://api.github.com/users/Minecolonies/events{/privacy}","received_events_url":"https://api.github.com/users/Minecolonies/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Minecolonies/minecolonies","description":"Minecolonies minecraft mod","fork":false,"url":"https://api.github.com/repos/Minecolonies/minecolonies","forks_url":"https://api.github.com/repos/Minecolonies/minecolonies/forks","keys_url":"https://api.github.com/repos/Minecolonies/minecolonies/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Minecolonies/minecolonies/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Minecolonies/minecolonies/teams","hooks_url":"https://api.github.com/repos/Minecolonies/minecolonies/hooks","issue_events_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/events{/number}","events_url":"https://api.github.com/repos/Minecolonies/minecolonies/events","assignees_url":"https://api.github.com/repos/Minecolonies/minecolonies/assignees{/user}","branches_url":"https://api.github.com/repos/Minecolonies/minecolonies/branches{/branch}","tags_url":"https://api.github.com/repos/Minecolonies/minecolonies/tags","blobs_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/refs{/sha}","trees_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Minecolonies/minecolonies/statuses/{sha}","languages_url":"https://api.github.com/repos/Minecolonies/minecolonies/languages","stargazers_url":"https://api.github.com/repos/Minecolonies/minecolonies/stargazers","contributors_url":"https://api.github.com/repos/Minecolonies/minecolonies/contributors","subscribers_url":"https://api.github.com/repos/Minecolonies/minecolonies/subscribers","subscription_url":"https://api.github.com/repos/Minecolonies/minecolonies/subscription","commits_url":"https://api.github.com/repos/Minecolonies/minecolonies/commits{/sha}","git_commits_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/commits{/sha}","comments_url":"https://api.github.com/repos/Minecolonies/minecolonies/comments{/number}","issue_comment_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/comments{/number}","contents_url":"https://api.github.com/repos/Minecolonies/minecolonies/contents/{+path}","compare_url":"https://api.github.com/repos/Minecolonies/minecolonies/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Minecolonies/minecolonies/merges","archive_url":"https://api.github.com/repos/Minecolonies/minecolonies/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Minecolonies/minecolonies/downloads","issues_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues{/number}","pulls_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls{/number}","milestones_url":"https://api.github.com/repos/Minecolonies/minecolonies/milestones{/number}","notifications_url":"https://api.github.com/repos/Minecolonies/minecolonies/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Minecolonies/minecolonies/labels{/name}","releases_url":"https://api.github.com/repos/Minecolonies/minecolonies/releases{/id}","deployments_url":"https://api.github.com/repos/Minecolonies/minecolonies/deployments","created_at":"2016-08-13T12:45:38Z","updated_at":"2017-05-28T05:29:31Z","pushed_at":"2017-05-28T21:06:35Z","git_url":"git://github.com/Minecolonies/minecolonies.git","ssh_url":"git@github.com:Minecolonies/minecolonies.git","clone_url":"https://github.com/Minecolonies/minecolonies.git","svn_url":"https://github.com/Minecolonies/minecolonies","homepage":"http://minecolonies.com/","size":16643,"stargazers_count":40,"watchers_count":40,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":113,"forks":36,"open_issues":113,"watchers":40,"default_branch":"version/1.11"}},"_links":{"self":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1101"},"html":{"href":"https://github.com/Minecolonies/minecolonies/pull/1101"},"issue":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/issues/1101"},"comments":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/issues/1101/comments"},"review_comments":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1101/comments"},"review_comment":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1101/commits"},"statuses":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/statuses/945b86d195fe355ee006c7c41de56eafe80af905"}}}}
{"actor":{"display_login":"codacy-bot"}}