mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-28 06:09:57 +00:00
Merge branch 'master' into api3/network_mcpe-1.0.5
This commit is contained in:
commit
a5a51fb9c5
@ -143,7 +143,7 @@ class CrashDump{
|
||||
$error = $lastExceptionError;
|
||||
}else{
|
||||
$error = (array) error_get_last();
|
||||
$error["trace"] = @getTrace(3);
|
||||
$error["trace"] = getTrace(4); //Skipping CrashDump->baseCrash, CrashDump->construct, Server->crashDump
|
||||
$errorConversion = [
|
||||
E_ERROR => "E_ERROR",
|
||||
E_WARNING => "E_WARNING",
|
||||
|
@ -3724,15 +3724,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
|
||||
public function setHealth($amount){
|
||||
parent::setHealth($amount);
|
||||
if($this->spawned === true){
|
||||
$pk = new SetHealthPacket();
|
||||
$pk->health = $this->getHealth();
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
}
|
||||
|
||||
public function attack($damage, EntityDamageEvent $source){
|
||||
if(!$this->isAlive()){
|
||||
return;
|
||||
|
@ -357,7 +357,7 @@ namespace pocketmine {
|
||||
return -1;
|
||||
}
|
||||
|
||||
function getTrace($start = 1, $trace = null){
|
||||
function getTrace($start = 0, $trace = null){
|
||||
if($trace === null){
|
||||
if(function_exists("xdebug_get_function_stack")){
|
||||
$trace = array_reverse(xdebug_get_function_stack());
|
||||
|
@ -2040,9 +2040,8 @@ class Server{
|
||||
$errline = $e->getLine();
|
||||
|
||||
$type = ($errno === E_ERROR or $errno === E_USER_ERROR) ? \LogLevel::ERROR : (($errno === E_USER_WARNING or $errno === E_WARNING) ? \LogLevel::WARNING : \LogLevel::NOTICE);
|
||||
if(($pos = strpos($errstr, "\n")) !== false){
|
||||
$errstr = substr($errstr, 0, $pos);
|
||||
}
|
||||
|
||||
$errstr = preg_replace('/\s+/', ' ', trim($errstr));
|
||||
|
||||
$errfile = cleanPath($errfile);
|
||||
|
||||
@ -2054,7 +2053,7 @@ class Server{
|
||||
"fullFile" => $e->getFile(),
|
||||
"file" => $errfile,
|
||||
"line" => $errline,
|
||||
"trace" => @getTrace(1, $trace)
|
||||
"trace" => getTrace(0, $trace)
|
||||
];
|
||||
|
||||
global $lastExceptionError, $lastError;
|
||||
|
@ -470,7 +470,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
if(isset($this->effects[$effect->getId()])){
|
||||
$oldEffect = $this->effects[$effect->getId()];
|
||||
if(
|
||||
abs($effect->getAmplifier()) <= ($oldEffect->getAmplifier())
|
||||
abs($effect->getAmplifier()) < ($oldEffect->getAmplifier())
|
||||
or (abs($effect->getAmplifier()) === abs($oldEffect->getAmplifier())
|
||||
and $effect->getDuration() < $oldEffect->getDuration())
|
||||
){
|
||||
|
@ -408,6 +408,12 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
|
||||
public function saveNBT(){
|
||||
parent::saveNBT();
|
||||
|
||||
$this->namedtag->foodLevel = new IntTag("foodLevel", $this->getFood());
|
||||
$this->namedtag->foodExhaustionLevel = new FloatTag("foodExhaustionLevel", $this->getExhaustion());
|
||||
$this->namedtag->foodSaturationLevel = new FloatTag("foodSaturationLevel", $this->getSaturation());
|
||||
$this->namedtag->foodTickTimer = new IntTag("foodTickTimer", $this->foodTickTimer);
|
||||
|
||||
$this->namedtag->Inventory = new ListTag("Inventory", []);
|
||||
$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);
|
||||
if($this->inventory !== null){
|
||||
|
@ -63,6 +63,10 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
foreach($this->getInventory()->getViewers() as $player){
|
||||
$player->removeWindow($this->getRealInventory());
|
||||
}
|
||||
|
||||
$this->inventory = null;
|
||||
$this->doubleInventory = null;
|
||||
|
||||
parent::close();
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +92,9 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
foreach($this->getInventory()->getViewers() as $player){
|
||||
$player->removeWindow($this->getInventory());
|
||||
}
|
||||
|
||||
$this->inventory = null;
|
||||
|
||||
parent::close();
|
||||
}
|
||||
}
|
||||
|
@ -134,12 +134,10 @@ class MainLogger extends \AttachableThreadedLogger{
|
||||
$type = ($errno === E_ERROR or $errno === E_USER_ERROR) ? LogLevel::ERROR : (($errno === E_USER_WARNING or $errno === E_WARNING) ? LogLevel::WARNING : LogLevel::NOTICE);
|
||||
}
|
||||
$errno = $errorConversion[$errno] ?? $errno;
|
||||
if(($pos = strpos($errstr, "\n")) !== false){
|
||||
$errstr = substr($errstr, 0, $pos);
|
||||
}
|
||||
$errstr = preg_replace('/\s+/', ' ', trim($errstr));
|
||||
$errfile = \pocketmine\cleanPath($errfile);
|
||||
$this->log($type, get_class($e) . ": \"$errstr\" ($errno) in \"$errfile\" at line $errline");
|
||||
foreach(@\pocketmine\getTrace(1, $trace) as $i => $line){
|
||||
foreach(\pocketmine\getTrace(0, $trace) as $i => $line){
|
||||
$this->debug($line);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user