Merge branch '3.5'

This commit is contained in:
Dylan K. Taylor 2019-01-20 15:53:47 +00:00
commit ae7d6cc4a2
2 changed files with 6 additions and 4 deletions

View File

@ -150,7 +150,7 @@ class ExperienceOrb extends Entity{
return null;
}
$entity = $this->server->getLevelManager()->findEntity($this->targetPlayerRuntimeId);
$entity = $this->level->getEntity($this->targetPlayerRuntimeId);
if($entity instanceof Human){
return $entity;
}
@ -159,7 +159,7 @@ class ExperienceOrb extends Entity{
}
public function setTargetPlayer(?Human $player) : void{
$this->targetPlayerRuntimeId = $player ? $player->getId() : null;
$this->targetPlayerRuntimeId = $player !== null ? $player->getId() : null;
}
public function entityBaseTick(int $tickDiff = 1) : bool{

View File

@ -62,6 +62,8 @@ class ProcessLoginTask extends AsyncTask{
public const MOJANG_ROOT_PUBLIC_KEY = "MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8ELkixyLcwlZryUQcu1TvPOmI2B7vX83ndnWRUaXm74wFfa5f/lwQNTfrLVHa2PmenpGI6JhIMUJaWZrjmMj90NoKNFSNBuKdm8rYiXsfaz3K36x/1U26HpG0ZxK/V1V";
private const CLOCK_DRIFT_MAX = 60;
/** @var PrivateKeyInterface|null */
private static $SERVER_PRIVATE_KEY = null;
@ -197,11 +199,11 @@ class ProcessLoginTask extends AsyncTask{
$claims = json_decode(self::b64UrlDecode($payloadB64), true);
$time = time();
if(isset($claims["nbf"]) and $claims["nbf"] > $time){
if(isset($claims["nbf"]) and $claims["nbf"] > $time + self::CLOCK_DRIFT_MAX){
throw new VerifyLoginException("%pocketmine.disconnect.invalidSession.tooEarly");
}
if(isset($claims["exp"]) and $claims["exp"] < $time){
if(isset($claims["exp"]) and $claims["exp"] < $time - self::CLOCK_DRIFT_MAX){
throw new VerifyLoginException("%pocketmine.disconnect.invalidSession.tooLate");
}