mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-27 13:49:55 +00:00
parent
ffcdf49912
commit
37bc1273ee
@ -1279,7 +1279,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
if($diff > 0.6 and $expectedVelocity < $this->speed->y and !$this->server->getAllowFlight()){
|
||||
if($this->inAirTicks < 100){
|
||||
$this->setMotion(new Vector3(0, $expectedVelocity, 0));
|
||||
}elseif($this->kick("Flying is not enabled on this server"))
|
||||
}elseif($this->kick("Flying is not enabled on this server")){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,9 @@ abstract class BaseInventory implements Inventory{
|
||||
$this->clear($i);
|
||||
}
|
||||
}else{
|
||||
$this->setItem($i, $items[$i]);
|
||||
if (!$this->setItem($i, $items[$i])){
|
||||
$this->clear($i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,8 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
|
||||
public function __construct(Chest $left, Chest $right){
|
||||
$this->left = $left->getRealInventory();
|
||||
$this->right = $right->getRealInventory();
|
||||
BaseInventory::__construct($this, InventoryType::get(InventoryType::DOUBLE_CHEST));
|
||||
$items = array_merge($this->left->getContents(), $this->right->getContents());
|
||||
BaseInventory::__construct($this, InventoryType::get(InventoryType::DOUBLE_CHEST), $items);
|
||||
}
|
||||
|
||||
public function getInventory(){
|
||||
@ -77,13 +78,19 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
|
||||
$items = array_slice($items, 0, $this->size, true);
|
||||
}
|
||||
|
||||
parent::setContents($items);
|
||||
|
||||
$leftItems = array_slice($items, 0, $this->left->getSize(), true);
|
||||
$this->left->setContents($leftItems);
|
||||
if(count($items) > $this->left->getSize()){
|
||||
$rightItems = array_slice($items, $this->left->getSize() - 1, $this->right->getSize(), true);
|
||||
$this->right->setContents($rightItems);
|
||||
for($i = 0; $i < $this->size; ++$i){
|
||||
if(!isset($items[$i])){
|
||||
if ($i < $this->left->size){
|
||||
if(isset($this->left->slots[$i])){
|
||||
$this->clear($i);
|
||||
}
|
||||
}elseif(isset($this->right->slots[$i - $this->left->size])){
|
||||
$this->clear($i);
|
||||
}
|
||||
}elseif(!$this->setItem($i, $items[$i])){
|
||||
$this->clear($i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user