Replace disallowed operators in src/network/

This commit is contained in:
Dylan K. Taylor
2022-01-20 19:11:32 +00:00
parent 2bcb629d78
commit be1996752a
15 changed files with 35 additions and 35 deletions

View File

@ -69,7 +69,7 @@ final class ItemTranslator{
private static function make() : self{
$data = Utils::assumeNotFalse(file_get_contents(Path::join(\pocketmine\BEDROCK_DATA_PATH, 'r16_to_current_item_map.json')), "Missing required resource file");
$json = json_decode($data, true);
if(!is_array($json) or !isset($json["simple"], $json["complex"]) || !is_array($json["simple"]) || !is_array($json["complex"])){
if(!is_array($json) || !isset($json["simple"], $json["complex"]) || !is_array($json["simple"]) || !is_array($json["complex"])){
throw new AssumptionFailedError("Invalid item table format");
}

View File

@ -156,7 +156,7 @@ class TypeConverter{
}else{
[$id, $meta] = $idMeta;
if($itemStack instanceof Durable and $itemStack->getDamage() > 0){
if($itemStack instanceof Durable && $itemStack->getDamage() > 0){
if($nbt !== null){
if(($existing = $nbt->getTag(self::DAMAGE_TAG)) !== null){
$nbt->removeTag(self::DAMAGE_TAG);
@ -266,7 +266,7 @@ class TypeConverter{
switch($action->sourceType){
case NetworkInventoryAction::SOURCE_CONTAINER:
$window = null;
if($action->windowId === ContainerIds::UI and $action->inventorySlot > 0){
if($action->windowId === ContainerIds::UI && $action->inventorySlot > 0){
if($action->inventorySlot === UIInventorySlotOffset::CREATED_ITEM_OUTPUT){
return null; //useless noise
}