mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
World: added setDisplayName()
this is an obvious use case, and I'm not really sure why it wasn't supported sooner.
This commit is contained in:
@ -51,6 +51,7 @@ use pocketmine\event\world\ChunkLoadEvent;
|
||||
use pocketmine\event\world\ChunkPopulateEvent;
|
||||
use pocketmine\event\world\ChunkUnloadEvent;
|
||||
use pocketmine\event\world\SpawnChangeEvent;
|
||||
use pocketmine\event\world\WorldDisplayNameChangeEvent;
|
||||
use pocketmine\event\world\WorldParticleEvent;
|
||||
use pocketmine\event\world\WorldSaveEvent;
|
||||
use pocketmine\event\world\WorldSoundEvent;
|
||||
@ -2971,6 +2972,16 @@ class World implements ChunkManager{
|
||||
return $this->displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the World display name.
|
||||
*/
|
||||
public function setDisplayName(string $name) : void{
|
||||
(new WorldDisplayNameChangeEvent($this, $this->displayName, $name))->call();
|
||||
|
||||
$this->displayName = $name;
|
||||
$this->provider->getWorldData()->setName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the World folder name. This will not change at runtime and will be unique to a world per runtime.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user