fixed #3702 and fix for setting timezone from php.ini

This commit is contained in:
Intyre 2015-12-19 23:58:05 +01:00
parent 261ce1ba8b
commit c1a484ee5c
No known key found for this signature in database
GPG Key ID: B06D41D26935005A
2 changed files with 15 additions and 5 deletions

View File

@ -3375,9 +3375,16 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
return true; return true;
} }
/**
* @param Vector3|Position|Location $pos
* @param float $yaw
* @param float $pitch
*
* @return bool
*/
public function teleport(Vector3 $pos, $yaw = null, $pitch = null){ public function teleport(Vector3 $pos, $yaw = null, $pitch = null){
if(!$this->isOnline()){ if(!$this->isOnline()){
return; return false;
} }
$oldPos = $this->getPosition(); $oldPos = $this->getPosition();
@ -3398,11 +3405,12 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$this->spawnToAll(); $this->spawnToAll();
} }
$this->resetFallDistance(); $this->resetFallDistance();
$this->nextChunkOrderRun = 0; $this->nextChunkOrderRun = 0;
$this->newPosition = null; $this->newPosition = null;
return true;
} }
return false;
} }
/** /**

View File

@ -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 * 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. * an incorrect timezone abbreviation in php.ini apparently.
*/ */
$default_timezone = date_default_timezone_get(); $timezone = ini_get("date.timezone");
if(strpos($default_timezone, "/") === false){ if(strpos($timezone, "/") === false){
$default_timezone = timezone_name_from_abbr($default_timezone); $default_timezone = timezone_name_from_abbr($timezone);
ini_set("date.timezone", $default_timezone); ini_set("date.timezone", $default_timezone);
date_default_timezone_set($default_timezone); date_default_timezone_set($default_timezone);
} else {
date_default_timezone_set($timezone);
} }
} }