diff --git a/README.md b/README.md index b007c55..7f3d1df 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ #QRcraft -Plugin for PocketMine-MP for creating QR panels (made from white and black wool blocks) +Plugin for PocketMine-MP for creating QR code panels (made from white and black wool blocks) Copyright (C) 2014 Clodyx @@ -19,11 +19,11 @@ Plugin for PocketMine-MP for creating QR panels (made from white and black wool ONLY OPs during gameplay (creative preferred) * `/qr` - shows help page -* `/qrt ` - test QR text/url to count number of needed blocks (NxN) -* `/qrc [Auto|horizontal|vertical]` - create QR panel/block -* `/qrl` - list QR panels IDs -* `/qrd ` - delete QR panel by ID (fills panel space with air) -* `/qrp ` - teleport you nearby QR panel with specified ID (IN WORK) +* `/qrt ` - test QR code text/url to count number of needed blocks (NxN) +* `/qrc [Auto|horizontal|vertical]` - create QR code panel +* `/qrl` - list QR code panels IDs +* `/qrd ` - delete QR code panel by ID (fills panel space with air) +* `/qrp ` - teleports the player nearby QR code panel with specified ID Example: * `/qrt http://google.com` @@ -32,23 +32,23 @@ Example: ``` * `/qrc http://google.com` - begins the creation for specified url in auto mode ``` -"QR block defined a (27x27) for 'http://google.com'" +"QR panel defined a (27x27) for 'http://google.com'" "Touch a block to create it!" - - NOW the player has to touch another block to create the QR planel. + - NOW the player has to touch another block to create the QR code panel. - the new panel will be created above touched block and to the player right side. - in auto mode, is player is inclined forward pointing downwards, - the QR panel will be generated horizontally, + the QR code panel will be generated horizontally, otherwise it will be generated vertically. -"QR block [1] created OK!" +"QR panel [1] created OK!" ``` * `/qrc http://google.com h` - begins the creation for specified url in horizontal mode ``` -"QR block defined h (27x27) for 'http://google.com'" +"QR panel defined h (27x27) for 'http://google.com'" "Touch a block to create it!" - now the player touches the block to build above. -"QR block [2] created OK!" +"QR panel [2] created OK!" ``` -* `/qrl` - list current defined QR panels +* `/qrl` - list current defined QR code panels ``` "--------------" "QR LIST" @@ -61,9 +61,13 @@ Example: ``` "QR panel [2] deleted." ``` +* `/qrp 2` - teleports the player nearby QR panel with ID 2 +``` +"You've been teleported nearby QR panel [2]." +``` ## Configuration -No configuration needed for this moment. +No configuration needed. ## Permissions @@ -77,3 +81,5 @@ PocketMine-MP version min 1.0.0 ## Releases [1.0.0] - initial release +[1.0.1] - improvements +[1.0.2] - implemented teleport player nearby QR code panel diff --git a/plugin.yml b/plugin.yml index b7da310..2689dc3 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,5 +1,5 @@ name: QRcraft -version: 1.0.1 +version: 1.0.2 api: 1.0.0 main: clodyx\qrcraft\QRcraftPlugIn author: Clodyx diff --git a/src/clodyx/qrcraft/QRcraftCommand.php b/src/clodyx/qrcraft/QRcraftCommand.php index 34bb354..4c8407f 100644 --- a/src/clodyx/qrcraft/QRcraftCommand.php +++ b/src/clodyx/qrcraft/QRcraftCommand.php @@ -12,6 +12,7 @@ namespace clodyx\qrcraft; use pocketmine\command\Command; use pocketmine\command\CommandSender; use pocketmine\command\CommandExecutor; +use pocketmine\math\Vector3; use pocketmine\Player; @@ -105,7 +106,37 @@ class QRcraftCommand } break; case "qrp": - //todo + if (!isset($this->pgin->qrlist) || count($this->pgin->qrlist) == 0) { + $player->sendMessage("QR panel list is empty!"); + } else { + if (isset ($args [0])) { + $idToTP = $args[0]; + $qrItem = null; + foreach ($this->pgin->qrlist as $li) { + if ($idToTP == $li[0]) { + $qrItem = $li; + } + } + if(isset($qrItem) && !is_null($qrItem) ) + { + //get qr code panel coords + $coord = $qrItem[3]; + $coord[0] = $coord[0] - 2; + $coord[2] = $coord[2] - 2; + //tp playr + $player->teleport(new Vector3($coord[0], $coord[1], $coord[2])); + $player->sendMessage("You've been teleported nearby QR panel [$idToTP]."); + } + else + { + $player->sendMessage("QR panel [$idToTP] not found."); + } + } + else + { + $this->showusage($sender); + } + } break; default: $this->showusage($sender); @@ -124,7 +155,7 @@ class QRcraftCommand $player->sendMessage("QRcraft usage:"); $player->sendMessage("/qr - help page"); $player->sendMessage("/qrt - test QR text size"); - $player->sendMessage("/qrc [Auto|horizontal|vertical] - create qr panel"); + $player->sendMessage("/qrc [Auto|horizontal|vertical] - create QR panel"); $player->sendMessage("/qrl - list QR panels IDs"); $player->sendMessage("/qrd - detele QR panel by ID"); $player->sendMessage("/qrp - teleport nearby QR panel by ID"); diff --git a/src/clodyx/qrcraft/QRhelper.php b/src/clodyx/qrcraft/QRhelper.php index cd55b81..7e978f7 100644 --- a/src/clodyx/qrcraft/QRhelper.php +++ b/src/clodyx/qrcraft/QRhelper.php @@ -201,7 +201,7 @@ class QRhelper $session["create"] = true; - $player->sendMessage("QR block defined $orientation (" . $size . "x" . $size . ") for '" . $url . "'"); + $player->sendMessage("QR panel defined $orientation (" . $size . "x" . $size . ") for '" . $url . "'"); $player->sendMessage("Touch a block to create it!"); } @@ -245,7 +245,7 @@ class QRhelper $session["create"] = false; $session["size"] = 0; - $player->sendMessage("QR block [$qrID] created OK!"); + $player->sendMessage("QR panel [$qrID] created OK!"); } }