v1.0.2 - implemented player teleportation nearby QR code panel

v1.0.2 - implemented player teleportation nearby QR code panel
This commit is contained in:
2015-01-08 12:11:17 +02:00
parent 6563ba887c
commit b52e8d3ecd
4 changed files with 56 additions and 19 deletions
+20 -14
View File
@@ -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 <https://github.com/farcasclaudiu/QRcraft>
@@ -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 <url>` - test QR text/url to count number of needed blocks (NxN)
* `/qrc <url> [Auto|horizontal|vertical]` - create QR panel/block
* `/qrl` - list QR panels IDs
* `/qrd <ID>` - delete QR panel by ID (fills panel space with air)
* `/qrp <ID>` - teleport you nearby QR panel with specified ID (IN WORK)
* `/qrt <url>` - test QR code text/url to count number of needed blocks (NxN)
* `/qrc <url> [Auto|horizontal|vertical]` - create QR code panel
* `/qrl` - list QR code panels IDs
* `/qrd <ID>` - delete QR code panel by ID (fills panel space with air)
* `/qrp <ID>` - 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
+1 -1
View File
@@ -1,5 +1,5 @@
name: QRcraft
version: 1.0.1
version: 1.0.2
api: 1.0.0
main: clodyx\qrcraft\QRcraftPlugIn
author: Clodyx
+33 -2
View File
@@ -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 <url> - test QR text size");
$player->sendMessage("/qrc <url> [Auto|horizontal|vertical] - create qr panel");
$player->sendMessage("/qrc <url> [Auto|horizontal|vertical] - create QR panel");
$player->sendMessage("/qrl - list QR panels IDs");
$player->sendMessage("/qrd <ID> - detele QR panel by ID");
$player->sendMessage("/qrp <ID> - teleport nearby QR panel by ID");
+2 -2
View File
@@ -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!");
}
}