hi guys, I wonder if it is possible for example. BlockHunt, when the player moves the block that slides on the ground instead of jumping from block to block? if it is possible how? Thank you
Use PlayerMoveEvent and setBlock() to wherever the player is and remove the previously set block. Idk how smooth this would look, it was just a quick idea.
This is what i had in mind: PHP: public function onEnable() { @mkdir($this->getDataFolder() . "Players/");}public function getLastX($playerName) { $this->lastX = new Config($this->getDataFolder() . "Players/" . strtolower($playerName) . ".yml", Config::YAML, array( "Last.X" => 0, )); return $this->lastX->get("Last.X");}public function getLastY($playerName) { $this->lastY = new Config($this->getDataFolder() . "Players/" . strtolower($playerName) . ".yml", Config::YAML, array( "Last.Y" => 0, )); return $this->lastY->get("Last.Y");}public function getLastZ($playerName) { $this->lastZ = new Config($this->getDataFolder() . "Players/" . strtolower($playerName) . ".yml", Config::YAML, array( "Last.Z" => 0, )); return $this->lastZ->get("Last.Z");}public function setLastX($playerName, $x) { $this->lastX = new Config($this->getDataFolder() . "Players/" . strtolower($playerName) . ".yml", Config::YAML, array( "Last.X" => 0, )); $this->lastX->set("Last.X", $x); $this->lastX->save();}public function setLastY($playerName, $y) { $this->lastY = new Config($this->getDataFolder() . "Players/" . strtolower($playerName) . ".yml", Config::YAML, array( "Last.Y" => 0, )); $this->lastY->set("Last.Y", $y); $this->lastY->save();}public function setLastZ($playerName, $z) { $this->lastZ = new Config($this->getDataFolder() . "Players/" . strtolower($playerName) . ".yml", Config::YAML, array( "Last.Z" => 0, )); $this->lastZ->set("Last.X", $z); $this->lastZ->save();}public function onMove(PlayerMoveEvent $event) { $player = $event->getPlayer(); $block = //Whatever block you want; $this->setLastX($player->getName(), $player->getX());// $this->setLastY($player->getName(), $player->getY());// Saves the players last coordinates $this->setLastZ($player->getName(), $player->getZ());// $player->getLevel()->setBlock(new Vector3($this->getLastX($player->getName()), $this->getLastY($player->getName()), $this->getLastZ($player->getName())), Block::get(Block::AIR)); // Unsets the block from players last position $player->getLevel()->setBlock(new Vector3($player), $block); //Moves the block to the player's current coordinates}
Or you could make the player "invisible" and spawn a falling sand entity that moves like the player would.