{"action":"created","comment":{"url":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/comments/181591846","pull_request_review_id":112246370,"id":181591846,"diff_hunk":"@@ -0,0 +1,98 @@\n+<?php\n+\n+/*\n+ *\n+ *  ____            _        _   __  __ _                  __  __ ____\n+ * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n+ * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n+ * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n+ * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n+ *\n+ * This program is free software: you can redistribute it and/or modify\n+ * it under the terms of the GNU Lesser General Public License as published by\n+ * the Free Software Foundation, either version 3 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * @author PocketMine Team\n+ * @link http://www.pocketmine.net/\n+ *\n+ *\n+*/\n+\n+declare(strict_types=1);\n+\n+namespace pocketmine\\command\\defaults;\n+\n+use pocketmine\\command\\Command;\n+use pocketmine\\command\\CommandSender;\n+use pocketmine\\command\\utils\\InvalidCommandSyntaxException;\n+use pocketmine\\lang\\TranslationContainer;\n+use pocketmine\\utils\\TextFormat;\n+use pocketmine\\Player;\n+\n+class XpCommand extends VanillaCommand{\n+\t\n+        public function __construct(string $name){\n+\t        parent::__construct(\n+\t\t        $name,\n+\t\t        \"%pocketmine.command.xp.description\",\n+\t\t        \"%pocketmine.command.xp.usage\"\n+\t\t);\n+\t$this->setPermission(\"pocketmine.command.xp\");\n+\t}\n+        \n+        public function execute(CommandSender $sender, string $commandLabel, array $args){\n+\t        if(!$this->testPermission($sender)){\n+\t\t        return true;\n+\t        }               \n+                \n+                if(count($args) < 1){\n+\t        throw new InvalidCommandSyntaxException();\n+\t        }\n+                \n+                if(isset($args[1])){\n+                        $player = $sender->getServer()->getPlayer($args[1]);\n+                        if($player === null){\n+\t                        $sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.player.notFound\"));\n+\t                        return true;\n+                        }\n+                }\n+                \n+                if(strtolower(substr($args[0], -1)) == \"l\"){\n+                        $lxp = $this->getInteger($sender, substr_replace($args[0], \"\", -1));\n+                        if(isset($args[1])){\n+                                $player->addXpLevels($lxp);\n+                                Command::broadcastCommandMessage($sender, new TranslationContainer(\"%commands.xp.success.other\", [\n+                                        $lxp,\n+                                        $player->getName()\n+                                ]));\n+                        }else{\n+                                if(!($sender instanceof Player)){\n+                                        throw new InvalidCommandSyntaxException;\n+                                }\n+                                $sender->getServer()->getPlayer($sender->getName())->addXpLevels($lxp);\n+                                Command::broadcastCommandMessage($sender, new TranslationContainer(\"%commands.xp.success.self\",[$lxp]));\n+                        }\n+                        return true;\n+                }\n+                \n+                if(is_numeric($args[0])){","path":"src/pocketmine/command/defaults/XpCommand.php","position":79,"original_position":79,"commit_id":"d8e7fd1ab1e821e443c2700edc9ccf0bfb8210e3","original_commit_id":"d8e7fd1ab1e821e443c2700edc9ccf0bfb8210e3","user":{"login":"dktapps","id":14214667,"avatar_url":"https://avatars2.githubusercontent.com/u/14214667?v=4","gravatar_id":"","url":"https://api.github.com/users/dktapps","html_url":"https://github.com/dktapps","followers_url":"https://api.github.com/users/dktapps/followers","following_url":"https://api.github.com/users/dktapps/following{/other_user}","gists_url":"https://api.github.com/users/dktapps/gists{/gist_id}","starred_url":"https://api.github.com/users/dktapps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dktapps/subscriptions","organizations_url":"https://api.github.com/users/dktapps/orgs","repos_url":"https://api.github.com/users/dktapps/repos","events_url":"https://api.github.com/users/dktapps/events{/privacy}","received_events_url":"https://api.github.com/users/dktapps/received_events","type":"User","site_admin":false},"body":"This should be using `if..elseif`, not abusing return statements.","created_at":"2018-04-15T18:13:03Z","updated_at":"2018-04-15T18:13:57Z","html_url":"https://github.com/pmmp/PocketMine-MP/pull/2151#discussion_r181591846","pull_request_url":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/2151","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/comments/181591846"},"html":{"href":"https://github.com/pmmp/PocketMine-MP/pull/2151#discussion_r181591846"},"pull_request":{"href":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/2151"}}},"pull_request":{"url":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/2151","id":181671051,"html_url":"https://github.com/pmmp/PocketMine-MP/pull/2151","diff_url":"https://github.com/pmmp/PocketMine-MP/pull/2151.diff","patch_url":"https://github.com/pmmp/PocketMine-MP/pull/2151.patch","issue_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/2151","number":2151,"state":"open","locked":false,"title":"Implementation of xp command","user":{"login":"killer549","id":11447051,"avatar_url":"https://avatars3.githubusercontent.com/u/11447051?v=4","gravatar_id":"","url":"https://api.github.com/users/killer549","html_url":"https://github.com/killer549","followers_url":"https://api.github.com/users/killer549/followers","following_url":"https://api.github.com/users/killer549/following{/other_user}","gists_url":"https://api.github.com/users/killer549/gists{/gist_id}","starred_url":"https://api.github.com/users/killer549/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killer549/subscriptions","organizations_url":"https://api.github.com/users/killer549/orgs","repos_url":"https://api.github.com/users/killer549/repos","events_url":"https://api.github.com/users/killer549/events{/privacy}","received_events_url":"https://api.github.com/users/killer549/received_events","type":"User","site_admin":false},"body":"## Introduction\r\n<!-- Explain existing problems or why this pull request is necessary -->\r\nImplement XP command as in vanilla \r\n\r\n## Changes\r\n### API changes\r\n<!-- Any additions to the API that should be documented in release notes? -->\r\nAdded new class XPCommand which has the command basics\r\n### Behavioural changes\r\n<!-- Any change in how the server behaves, or its performance? -->\r\nN/A\r\n## Backwards compatibility\r\n<!-- Any possible backwards incompatible changes? How are they solved, or how can they be solved? -->\r\nN/A\r\n\r\nRequires translations:\r\n\r\n| Name | Value in eng.ini |\r\n| `commands.xp.success.other` | `Gave {%0} to {%1)` |\r\n| `commands.xp.success.self` | `Gave himself {%0}` |\r\n| `commands.xp.usage` | `/xp <amount> [Player]` |\r\n| `pocketmine.command.xp.usage` | `/xp <experience[L]> <player>` |\r\n\r\n-->\r\n\r\n## Tests\r\nI've tried the command with different situations (Player offline or not found, L letter adds level, Op can give to himself, etc..)\r\n\r\nI've small problem with messages in console as in the game I get player1: gave 40 experience to player2 while on console i get player1: gave 40 to {%1}.I'll try my best in working on that\r\n<!--\r\nDetails should be provided of tests done. Simply saying \"tested\" or equivalent is not acceptable.\r\n\r\nAttach scripts or actions to test this pull request, as well as the result\r\n-->\r\n","created_at":"2018-04-14T22:54:21Z","updated_at":"2018-04-15T18:13:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44e91b4b573b0abb7acac26dfc272ffac405ae53","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":454785622,"url":"https://api.github.com/repos/pmmp/PocketMine-MP/labels/Category:%20Gameplay","name":"Category: Gameplay","color":"00aa55","default":false},{"id":454787972,"url":"https://api.github.com/repos/pmmp/PocketMine-MP/labels/PR:%20Contribution","name":"PR: Contribution","color":"bfdadc","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/2151/commits","review_comments_url":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/2151/comments","review_comment_url":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/2151/comments","statuses_url":"https://api.github.com/repos/pmmp/PocketMine-MP/statuses/d8e7fd1ab1e821e443c2700edc9ccf0bfb8210e3","head":{"label":"killer549:master","ref":"master","sha":"d8e7fd1ab1e821e443c2700edc9ccf0bfb8210e3","user":{"login":"killer549","id":11447051,"avatar_url":"https://avatars3.githubusercontent.com/u/11447051?v=4","gravatar_id":"","url":"https://api.github.com/users/killer549","html_url":"https://github.com/killer549","followers_url":"https://api.github.com/users/killer549/followers","following_url":"https://api.github.com/users/killer549/following{/other_user}","gists_url":"https://api.github.com/users/killer549/gists{/gist_id}","starred_url":"https://api.github.com/users/killer549/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killer549/subscriptions","organizations_url":"https://api.github.com/users/killer549/orgs","repos_url":"https://api.github.com/users/killer549/repos","events_url":"https://api.github.com/users/killer549/events{/privacy}","received_events_url":"https://api.github.com/users/killer549/received_events","type":"User","site_admin":false},"repo":{"id":129543928,"name":"PocketMine-MP","full_name":"killer549/PocketMine-MP","owner":{"login":"killer549","id":11447051,"avatar_url":"https://avatars3.githubusercontent.com/u/11447051?v=4","gravatar_id":"","url":"https://api.github.com/users/killer549","html_url":"https://github.com/killer549","followers_url":"https://api.github.com/users/killer549/followers","following_url":"https://api.github.com/users/killer549/following{/other_user}","gists_url":"https://api.github.com/users/killer549/gists{/gist_id}","starred_url":"https://api.github.com/users/killer549/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killer549/subscriptions","organizations_url":"https://api.github.com/users/killer549/orgs","repos_url":"https://api.github.com/users/killer549/repos","events_url":"https://api.github.com/users/killer549/events{/privacy}","received_events_url":"https://api.github.com/users/killer549/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/killer549/PocketMine-MP","description":"A server software for Minecraft: Broken Edition in PHP","fork":true,"url":"https://api.github.com/repos/killer549/PocketMine-MP","forks_url":"https://api.github.com/repos/killer549/PocketMine-MP/forks","keys_url":"https://api.github.com/repos/killer549/PocketMine-MP/keys{/key_id}","collaborators_url":"https://api.github.com/repos/killer549/PocketMine-MP/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/killer549/PocketMine-MP/teams","hooks_url":"https://api.github.com/repos/killer549/PocketMine-MP/hooks","issue_events_url":"https://api.github.com/repos/killer549/PocketMine-MP/issues/events{/number}","events_url":"https://api.github.com/repos/killer549/PocketMine-MP/events","assignees_url":"https://api.github.com/repos/killer549/PocketMine-MP/assignees{/user}","branches_url":"https://api.github.com/repos/killer549/PocketMine-MP/branches{/branch}","tags_url":"https://api.github.com/repos/killer549/PocketMine-MP/tags","blobs_url":"https://api.github.com/repos/killer549/PocketMine-MP/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/killer549/PocketMine-MP/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/killer549/PocketMine-MP/git/refs{/sha}","trees_url":"https://api.github.com/repos/killer549/PocketMine-MP/git/trees{/sha}","statuses_url":"https://api.github.com/repos/killer549/PocketMine-MP/statuses/{sha}","languages_url":"https://api.github.com/repos/killer549/PocketMine-MP/languages","stargazers_url":"https://api.github.com/repos/killer549/PocketMine-MP/stargazers","contributors_url":"https://api.github.com/repos/killer549/PocketMine-MP/contributors","subscribers_url":"https://api.github.com/repos/killer549/PocketMine-MP/subscribers","subscription_url":"https://api.github.com/repos/killer549/PocketMine-MP/subscription","commits_url":"https://api.github.com/repos/killer549/PocketMine-MP/commits{/sha}","git_commits_url":"https://api.github.com/repos/killer549/PocketMine-MP/git/commits{/sha}","comments_url":"https://api.github.com/repos/killer549/PocketMine-MP/comments{/number}","issue_comment_url":"https://api.github.com/repos/killer549/PocketMine-MP/issues/comments{/number}","contents_url":"https://api.github.com/repos/killer549/PocketMine-MP/contents/{+path}","compare_url":"https://api.github.com/repos/killer549/PocketMine-MP/compare/{base}...{head}","merges_url":"https://api.github.com/repos/killer549/PocketMine-MP/merges","archive_url":"https://api.github.com/repos/killer549/PocketMine-MP/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/killer549/PocketMine-MP/downloads","issues_url":"https://api.github.com/repos/killer549/PocketMine-MP/issues{/number}","pulls_url":"https://api.github.com/repos/killer549/PocketMine-MP/pulls{/number}","milestones_url":"https://api.github.com/repos/killer549/PocketMine-MP/milestones{/number}","notifications_url":"https://api.github.com/repos/killer549/PocketMine-MP/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/killer549/PocketMine-MP/labels{/name}","releases_url":"https://api.github.com/repos/killer549/PocketMine-MP/releases{/id}","deployments_url":"https://api.github.com/repos/killer549/PocketMine-MP/deployments","created_at":"2018-04-14T18:31:27Z","updated_at":"2018-04-15T17:58:26Z","pushed_at":"2018-04-15T17:58:24Z","git_url":"git://github.com/killer549/PocketMine-MP.git","ssh_url":"git@github.com:killer549/PocketMine-MP.git","clone_url":"https://github.com/killer549/PocketMine-MP.git","svn_url":"https://github.com/killer549/PocketMine-MP","homepage":"https://pmmp.io","size":20244,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pmmp:master","ref":"master","sha":"1e2122d85491cc535aef4ee8548d963996ecf984","user":{"login":"pmmp","id":22548559,"avatar_url":"https://avatars2.githubusercontent.com/u/22548559?v=4","gravatar_id":"","url":"https://api.github.com/users/pmmp","html_url":"https://github.com/pmmp","followers_url":"https://api.github.com/users/pmmp/followers","following_url":"https://api.github.com/users/pmmp/following{/other_user}","gists_url":"https://api.github.com/users/pmmp/gists{/gist_id}","starred_url":"https://api.github.com/users/pmmp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmmp/subscriptions","organizations_url":"https://api.github.com/users/pmmp/orgs","repos_url":"https://api.github.com/users/pmmp/repos","events_url":"https://api.github.com/users/pmmp/events{/privacy}","received_events_url":"https://api.github.com/users/pmmp/received_events","type":"Organization","site_admin":false},"repo":{"id":69691727,"name":"PocketMine-MP","full_name":"pmmp/PocketMine-MP","owner":{"login":"pmmp","id":22548559,"avatar_url":"https://avatars2.githubusercontent.com/u/22548559?v=4","gravatar_id":"","url":"https://api.github.com/users/pmmp","html_url":"https://github.com/pmmp","followers_url":"https://api.github.com/users/pmmp/followers","following_url":"https://api.github.com/users/pmmp/following{/other_user}","gists_url":"https://api.github.com/users/pmmp/gists{/gist_id}","starred_url":"https://api.github.com/users/pmmp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmmp/subscriptions","organizations_url":"https://api.github.com/users/pmmp/orgs","repos_url":"https://api.github.com/users/pmmp/repos","events_url":"https://api.github.com/users/pmmp/events{/privacy}","received_events_url":"https://api.github.com/users/pmmp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pmmp/PocketMine-MP","description":"A server software for Minecraft: Broken Edition in PHP","fork":false,"url":"https://api.github.com/repos/pmmp/PocketMine-MP","forks_url":"https://api.github.com/repos/pmmp/PocketMine-MP/forks","keys_url":"https://api.github.com/repos/pmmp/PocketMine-MP/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pmmp/PocketMine-MP/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pmmp/PocketMine-MP/teams","hooks_url":"https://api.github.com/repos/pmmp/PocketMine-MP/hooks","issue_events_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/events{/number}","events_url":"https://api.github.com/repos/pmmp/PocketMine-MP/events","assignees_url":"https://api.github.com/repos/pmmp/PocketMine-MP/assignees{/user}","branches_url":"https://api.github.com/repos/pmmp/PocketMine-MP/branches{/branch}","tags_url":"https://api.github.com/repos/pmmp/PocketMine-MP/tags","blobs_url":"https://api.github.com/repos/pmmp/PocketMine-MP/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pmmp/PocketMine-MP/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pmmp/PocketMine-MP/git/refs{/sha}","trees_url":"https://api.github.com/repos/pmmp/PocketMine-MP/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pmmp/PocketMine-MP/statuses/{sha}","languages_url":"https://api.github.com/repos/pmmp/PocketMine-MP/languages","stargazers_url":"https://api.github.com/repos/pmmp/PocketMine-MP/stargazers","contributors_url":"https://api.github.com/repos/pmmp/PocketMine-MP/contributors","subscribers_url":"https://api.github.com/repos/pmmp/PocketMine-MP/subscribers","subscription_url":"https://api.github.com/repos/pmmp/PocketMine-MP/subscription","commits_url":"https://api.github.com/repos/pmmp/PocketMine-MP/commits{/sha}","git_commits_url":"https://api.github.com/repos/pmmp/PocketMine-MP/git/commits{/sha}","comments_url":"https://api.github.com/repos/pmmp/PocketMine-MP/comments{/number}","issue_comment_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/comments{/number}","contents_url":"https://api.github.com/repos/pmmp/PocketMine-MP/contents/{+path}","compare_url":"https://api.github.com/repos/pmmp/PocketMine-MP/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pmmp/PocketMine-MP/merges","archive_url":"https://api.github.com/repos/pmmp/PocketMine-MP/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pmmp/PocketMine-MP/downloads","issues_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues{/number}","pulls_url":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls{/number}","milestones_url":"https://api.github.com/repos/pmmp/PocketMine-MP/milestones{/number}","notifications_url":"https://api.github.com/repos/pmmp/PocketMine-MP/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pmmp/PocketMine-MP/labels{/name}","releases_url":"https://api.github.com/repos/pmmp/PocketMine-MP/releases{/id}","deployments_url":"https://api.github.com/repos/pmmp/PocketMine-MP/deployments","created_at":"2016-09-30T18:29:35Z","updated_at":"2018-04-15T10:54:23Z","pushed_at":"2018-04-15T18:03:28Z","git_url":"git://github.com/pmmp/PocketMine-MP.git","ssh_url":"git@github.com:pmmp/PocketMine-MP.git","clone_url":"https://github.com/pmmp/PocketMine-MP.git","svn_url":"https://github.com/pmmp/PocketMine-MP","homepage":"https://pmmp.io","size":20176,"stargazers_count":867,"watchers_count":867,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":675,"mirror_url":null,"archived":false,"open_issues_count":82,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0"},"forks":675,"open_issues":82,"watchers":867,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/2151"},"html":{"href":"https://github.com/pmmp/PocketMine-MP/pull/2151"},"issue":{"href":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/2151"},"comments":{"href":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/2151/comments"},"review_comments":{"href":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/2151/comments"},"review_comment":{"href":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pmmp/PocketMine-MP/pulls/2151/commits"},"statuses":{"href":"https://api.github.com/repos/pmmp/PocketMine-MP/statuses/d8e7fd1ab1e821e443c2700edc9ccf0bfb8210e3"}},"author_association":"NONE"}}
{"actor":{"display_login":"dktapps"}}