Fix position of setworldspawn command (#4574)

* The world spawn position is no longer rounded

* Remove round() since the position is always int
This commit is contained in:
ねらひかだ 2021-11-15 00:40:20 +09:00 committed by GitHub
parent 399824c31c
commit d4a382d568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,6 @@ use pocketmine\permission\DefaultPermissionNames;
use pocketmine\player\Player;
use pocketmine\utils\TextFormat;
use function count;
use function round;
class SetWorldSpawnCommand extends VanillaCommand{
@ -54,7 +53,7 @@ class SetWorldSpawnCommand extends VanillaCommand{
if($sender instanceof Player){
$location = $sender->getPosition();
$world = $location->getWorld();
$pos = $location->asVector3()->round();
$pos = $location->asVector3()->floor();
}else{
$sender->sendMessage(TextFormat::RED . "You can only perform this command as a player");
@ -69,7 +68,7 @@ class SetWorldSpawnCommand extends VanillaCommand{
$world->setSpawnLocation($pos);
Command::broadcastCommandMessage($sender, KnownTranslationFactory::commands_setworldspawn_success((string) round($pos->x, 2), (string) round($pos->y, 2), (string) round($pos->z, 2)));
Command::broadcastCommandMessage($sender, KnownTranslationFactory::commands_setworldspawn_success((string) $pos->x, (string) $pos->y, (string) $pos->z));
return true;
}