public static function CreateQRAndUnmark(QRcraftPlugIn $plugin, Player $player, $blockTouched, $level, $addMargin) { $session =& $plugin->session($player); $toCreate = $session["create"]; if ($toCreate) { $textToQR = $session["url"]; $size = $session["size"]; $orient = strtolower($session["orientation"]); $allor = array("h", "v", "a"); if (!in_array($orient, $allor)) { $orient = "a"; } //calculate orientation $direction = $player->getDirectionVector(); $orient = $orient[0] == "a" ? abs($direction->y) > 0.9 ? "h" : "v" : $orient; $build = $orient; if (abs($direction->z) > abs($direction->x)) { //we build blocks on X axis (east+/west-) $build = $build . "x" . ($direction->z > 0 ? "1" : "0"); } else { //we build blocks on Z axis (south+/north-) $build = $build . "z" . ($direction->x > 0 ? "1" : "0"); } //create qr block $genCoords = QRhelper::CreateQRCode($blockTouched, $level, $addMargin, $textToQR, $build); //save qr block in list $qrID = QRhelper::SaveQR($plugin, $textToQR, $size, $genCoords); //unmark $session["url"] = ""; $session["orientation"] = "a"; $session["create"] = false; $session["size"] = 0; $player->sendMessage("QR panel [{$qrID}] created OK!"); } }