From c1a484ee5cb8705f03e5021a64fe824796dfee14 Mon Sep 17 00:00:00 2001 From: Intyre Date: Sat, 19 Dec 2015 23:58:05 +0100 Subject: [PATCH] fixed #3702 and fix for setting timezone from php.ini --- src/pocketmine/Player.php | 12 ++++++++++-- src/pocketmine/PocketMine.php | 8 +++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index f1985bc04..acd3d5de6 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -3375,9 +3375,16 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade return true; } + /** + * @param Vector3|Position|Location $pos + * @param float $yaw + * @param float $pitch + * + * @return bool + */ public function teleport(Vector3 $pos, $yaw = null, $pitch = null){ if(!$this->isOnline()){ - return; + return false; } $oldPos = $this->getPosition(); @@ -3398,11 +3405,12 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade $this->spawnToAll(); } - $this->resetFallDistance(); $this->nextChunkOrderRun = 0; $this->newPosition = null; + return true; } + return false; } /** diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index a4facf3dc..f5e70a574 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -164,11 +164,13 @@ namespace pocketmine { * This is here so that people don't come to us complaining and fill up the issue tracker when they put * an incorrect timezone abbreviation in php.ini apparently. */ - $default_timezone = date_default_timezone_get(); - if(strpos($default_timezone, "/") === false){ - $default_timezone = timezone_name_from_abbr($default_timezone); + $timezone = ini_get("date.timezone"); + if(strpos($timezone, "/") === false){ + $default_timezone = timezone_name_from_abbr($timezone); ini_set("date.timezone", $default_timezone); date_default_timezone_set($default_timezone); + } else { + date_default_timezone_set($timezone); } }