Replace disallowed operators in src/inventory/

This commit is contained in:
Dylan K. Taylor 2022-01-20 19:20:32 +00:00
parent b85fe0e72a
commit e986a0a4f2
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
3 changed files with 5 additions and 5 deletions

View File

@ -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{

View File

@ -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();
}
/**

View File

@ -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]);
}