PHP: if($player->getLevel()->getName() === "worldName") {/*i do change lvdat with this that*//*Or*/if($player->getLevel()->getLevelByName() === "worldName") {
Neither because both will give you errors PHP: if($player->getLevel()->getName() === "worldName") { //do stuff}
Level->getName() returns the name in level.dat. Level->getFolderName() returns the name of the folder containing the level. Two loaded levels can have the same Level->getName(), but they can't have the same Level->getFolderName(). So Level->getFolderName() is the unique identifier, while Level->getName() is just the display name. If you use /status, if the folder name is different from the level.dat name, it will display format: Code: World "folder name" (level.dat name): When you use Server->getLevelByName($name), the function actually compares the $name against the folder name of each loaded level. So, there is no good reason to use Level->getName() except for displaying to the user.