mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-17 08:54:22 +00:00
Fix crashes
This commit is contained in:
parent
2290c33143
commit
ab943a0462
@ -103,7 +103,7 @@ abstract class BaseInventory implements Inventory{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getItem($index){
|
public function getItem($index){
|
||||||
return isset($this->slots[$index]) ? clone $this->slots[$index] : Item::get(Item::AIR, null, 0);
|
return isset($this->slots[$index]) ? clone $this->slots[$index] : Item::get(Item::AIR, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getContents(){
|
public function getContents(){
|
||||||
@ -343,7 +343,7 @@ abstract class BaseInventory implements Inventory{
|
|||||||
|
|
||||||
public function clear($index){
|
public function clear($index){
|
||||||
if(isset($this->slots[$index])){
|
if(isset($this->slots[$index])){
|
||||||
$item = Item::get(Item::AIR, null, 0);
|
$item = Item::get(Item::AIR, 0, 0);
|
||||||
$old = $this->slots[$index];
|
$old = $this->slots[$index];
|
||||||
$holder = $this->getHolder();
|
$holder = $this->getHolder();
|
||||||
if($holder instanceof Entity){
|
if($holder instanceof Entity){
|
||||||
|
@ -238,7 +238,7 @@ class PlayerInventory extends BaseInventory{
|
|||||||
|
|
||||||
public function clear($index){
|
public function clear($index){
|
||||||
if(isset($this->slots[$index])){
|
if(isset($this->slots[$index])){
|
||||||
$item = Item::get(Item::AIR, null, 0);
|
$item = Item::get(Item::AIR, 0, 0);
|
||||||
$old = $this->slots[$index];
|
$old = $this->slots[$index];
|
||||||
if($index >= $this->getSize() and $index < $this->size){ //Armor change
|
if($index >= $this->getSize() and $index < $this->size){ //Armor change
|
||||||
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityArmorChangeEvent($this->getHolder(), $old, $item, $index));
|
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityArmorChangeEvent($this->getHolder(), $old, $item, $index));
|
||||||
@ -329,7 +329,7 @@ class PlayerInventory extends BaseInventory{
|
|||||||
public function setArmorContents(array $items){
|
public function setArmorContents(array $items){
|
||||||
for($i = 0; $i < 4; ++$i){
|
for($i = 0; $i < 4; ++$i){
|
||||||
if(!isset($items[$i]) or !($items[$i] instanceof Item)){
|
if(!isset($items[$i]) or !($items[$i] instanceof Item)){
|
||||||
$items[$i] = Item::get(Item::AIR, null, 0);
|
$items[$i] = Item::get(Item::AIR, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($items[$i]->getId() === Item::AIR){
|
if($items[$i]->getId() === Item::AIR){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user