Closed inxomnyaa closed 6 years ago
@thebigsmileXD I do agree with you, I used to use buttons, but found they were to glitchy (because of the way I did it), so I switched to typing fn. if you wish tho you can help us, but of course if u do not wish to you do not have to. tbh I'd love the help because I am not very good on my own lol
@thebigsmileXD Speaking of which, would it be possible to use both button form and input form in the same UI?
$worlds = array_map(function (Level $level){
return new MenuOption($level->getName());
}, Server::getInstance()->getLevels());
$player->sendForm(
new class(TextFormat::DARK_PURPLE . "Worlds", "Teleport to any world", array_values($worlds)) extends MenuForm{
public function onSubmit(Player $player): ?Form{
$selectedOption = $this->getSelectedOption()->getText();
$world = Server::getInstance()->getLevelByName($selectedOption);
if (!is_null($world)) $player->teleport($world->getSpawnLocation());
else $player->sendForm(new class("World was not found", "Please contact an administrator about this\nError: World not found\nWorldname: " . $selectedOption, "gui.yes", "gui.no") extends ModalForm{
}, true);
return null;
}
}
, true
);
This is what i do to display all loaded worlds.
@TheRoyalBlock no
That's an interesting way of doing it, but I don't think that'll work with the way that @ZeroDevOfficial coded the simpleui
@TheRoyalBlock I believe that is the pmmp api, and i'm pretty sure that you have to use the forms-api branch to use that code, I doubt that will work in pmmp's current state, but I have not attempted to use it. so i'm not sure, I took the easy way out with my method
Ah, okey doke
@thebigsmileXD I was able to get your ui method to work and I really like it, I think once the forms api is out on pmmp I will push an update to this plugin, for now though I will use the method currently in use, I will open a branch, where the new code will be located, of course once the forms api branch is merged with the master in pmmp I will push the update out for this plugin, hopefully dylan merges the forms api soon
also was able to trigger this lol, by unloading the world when the cmd was ran, wanted to see if it worked
sweet!
Well since I have this pretty much done in the pull https://github.com/PlexusStudio/WorldTpUI/pull/6 I'm going to close this
You could use a ButtonForm instead, that would be like a clickable list Typing the name of the world is "annoying"/takes too long if it uses long world names/names with colors etc