Skip to content

Instantly share code, notes, and snippets.

@TheNewHEROBRINEX
Last active September 9, 2017 19:45
Show Gist options
  • Save TheNewHEROBRINEX/893580c9c6599d97a75d3f7b62b002c5 to your computer and use it in GitHub Desktop.
Save TheNewHEROBRINEX/893580c9c6599d97a75d3f7b62b002c5 to your computer and use it in GitHub Desktop.
<?php
/**
* @name WorldNamesFixer
* @main TheNewHEROBRINE\WorldNamesFixer\Main
* @version 1.0.0
* @api 3.0.0-ALPHA7
* @author TheNewHEROBRINE
*/
namespace TheNewHEROBRINE\WorldNamesFixer {
class Main extends \pocketmine\plugin\PluginBase implements \pocketmine\event\Listener {
public function onEnable() {
foreach (glob($this->getServer()->getDataPath(). "worlds/*") as $f) {
$world = basename($f);
if ($this->getServer()->isLevelLoaded($world)) continue;
if (!$this->getServer()->isLevelGenerated($world)) continue;
$this->getServer()->loadLevel($world);
}
foreach ($this->getServer()->getLevels() as $level) {
echo PHP_EOL. $level->getName() . "->";
$level->getProvider()->getLevelData()->LevelName = new \pocketmine\nbt\tag\StringTag("LevelName", $level->getFolderName());
echo $level->getName();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment