pmmp / PocketMine-MP

A server software for Minecraft: Bedrock Edition in PHP
https://pmmp.io
GNU Lesser General Public License v3.0
3.26k stars 1.54k forks source link

Adding $player->isInWorld or something else #5210

Closed ItsToxicGGAlt closed 2 years ago

ItsToxicGGAlt commented 2 years ago

Description

adding $player->isInWorld(); it would be a good addition for example

if($player->isInWorld() === "World Name"){
    $event->cancel();
// or like
if($player->isInWorld("World Name"){
    $event->cancel(); // example

i am not sure if there this is a feature already but im still checking

Justification

because it would make peoples life easier when coding and its a good idea because then people that dont know to much.

NhanAZ commented 2 years ago
/**
* Returns the World display name.
* WARNING: This is NOT guaranteed to be unique. Multiple worlds at runtime may share the same display name.
*/
$player->getWorld()->getDisplayName();

// https://github.com/pmmp/PocketMine-MP/blob/stable/src/world/World.php#L2702
/**
* Returns the World folder name. This will not change at runtime and will be unique to a world per runtime.
*/
$player->getWorld()->getFolderName();

// https://github.com/pmmp/PocketMine-MP/blob/stable/src/world/World.php#L2709
github-actions[bot] commented 2 years ago

Hi, we only accept bug reports on this issue tracker, but this issue looks like a support request.

Instead of creating an issue, try the following:

Docs | Discord | Forums