mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 08:56:15 +00:00
Replace disallowed operators in src/inventory/
This commit is contained in:
@ -146,7 +146,7 @@ abstract class BaseInventory implements Inventory{
|
|||||||
$checkTags = $exact || $item->hasNamedTag();
|
$checkTags = $exact || $item->hasNamedTag();
|
||||||
|
|
||||||
foreach($this->getContents() as $index => $i){
|
foreach($this->getContents() as $index => $i){
|
||||||
if($item->equals($i, $checkDamage, $checkTags) and ($i->getCount() === $count or (!$exact and $i->getCount() > $count))){
|
if($item->equals($i, $checkDamage, $checkTags) && ($i->getCount() === $count || (!$exact && $i->getCount() > $count))){
|
||||||
return $index;
|
return $index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ abstract class BaseInventory implements Inventory{
|
|||||||
$emptySlots[] = $i;
|
$emptySlots[] = $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($slot->canStackWith($item) and $item->getCount() < $item->getMaxStackSize()){
|
if($slot->canStackWith($item) && $item->getCount() < $item->getMaxStackSize()){
|
||||||
$amount = min($item->getMaxStackSize() - $item->getCount(), $slot->getCount(), $this->getMaxStackSize());
|
$amount = min($item->getMaxStackSize() - $item->getCount(), $slot->getCount(), $this->getMaxStackSize());
|
||||||
if($amount > 0){
|
if($amount > 0){
|
||||||
$slot->setCount($slot->getCount() - $amount);
|
$slot->setCount($slot->getCount() - $amount);
|
||||||
@ -367,7 +367,7 @@ abstract class BaseInventory implements Inventory{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function slotExists(int $slot) : bool{
|
public function slotExists(int $slot) : bool{
|
||||||
return $slot >= 0 and $slot < $this->getSize();
|
return $slot >= 0 && $slot < $this->getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getListeners() : ObjectSet{
|
public function getListeners() : ObjectSet{
|
||||||
|
@ -49,7 +49,7 @@ class PlayerInventory extends SimpleInventory{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function isHotbarSlot(int $slot) : bool{
|
public function isHotbarSlot(int $slot) : bool{
|
||||||
return $slot >= 0 and $slot <= $this->getHotbarSize();
|
return $slot >= 0 && $slot <= $this->getHotbarSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,7 +92,7 @@ class CraftingTransaction extends InventoryTransaction{
|
|||||||
|
|
||||||
$haveCount = 0;
|
$haveCount = 0;
|
||||||
foreach($txItems as $j => $txItem){
|
foreach($txItems as $j => $txItem){
|
||||||
if($txItem->equals($recipeItem, !$wildcards or !$recipeItem->hasAnyDamageValue(), !$wildcards or $recipeItem->hasNamedTag())){
|
if($txItem->equals($recipeItem, !$wildcards || !$recipeItem->hasAnyDamageValue(), !$wildcards || $recipeItem->hasNamedTag())){
|
||||||
$haveCount += $txItem->getCount();
|
$haveCount += $txItem->getCount();
|
||||||
unset($txItems[$j]);
|
unset($txItems[$j]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user