mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Replace disallowed operators in src/inventory/
This commit is contained in:
parent
b85fe0e72a
commit
e986a0a4f2
@ -146,7 +146,7 @@ abstract class BaseInventory implements Inventory{
|
||||
$checkTags = $exact || $item->hasNamedTag();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -224,7 +224,7 @@ abstract class BaseInventory implements Inventory{
|
||||
$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());
|
||||
if($amount > 0){
|
||||
$slot->setCount($slot->getCount() - $amount);
|
||||
@ -367,7 +367,7 @@ abstract class BaseInventory implements Inventory{
|
||||
}
|
||||
|
||||
public function slotExists(int $slot) : bool{
|
||||
return $slot >= 0 and $slot < $this->getSize();
|
||||
return $slot >= 0 && $slot < $this->getSize();
|
||||
}
|
||||
|
||||
public function getListeners() : ObjectSet{
|
||||
|
@ -49,7 +49,7 @@ class PlayerInventory extends SimpleInventory{
|
||||
}
|
||||
|
||||
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;
|
||||
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();
|
||||
unset($txItems[$j]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user