Like i said, the player can only be at 1 position, so when you check it like that only 1 of the if wil be true unless they are checking the same position, use or instead
PHP: $inside=false;foreach($nrs as $nr) { if($player->getLevel()->getBlock($player->subtract(0,$nr,0))->getID() == 1 or $player->getLevel()->getBlock($player->subtract(0,-$nr,0))->getID() == 1) { $inside=true; break; }}if($inside) $player->sendPopup(TextFormat::GREEN . "You are in a stone room");
PHP: $up = false;$down = false;for($i=1;$i <= 5;$i++){ if($player->getLevel()->getBlock($player->subtract(0,$i,0))->getID() == 1) $down=true; if($player->getLevel()->getBlock($player->add(0,$i,0))->getID() == 1) $up = true;}if($up and $down) $player->sendPopup(TextFormat::GREEN . "You are in a stone room");
Depends on how you want to identify where is left and right side of the player Just add these 4 lines Before for loop: PHP: $upup = false;$downdown = false; Inside for loop: PHP: if($player->getLevel()->getBlock($player->subtract(0,$i+1,0))->getID() == 1) $downdown=true;if($player->getLevel()->getBlock($player->add(0,$i+1,0))->getID() == 1) $upup = true;#if block under down is stone, $downdown is true, same goes for $upup