Skip to content
VennV edited this page Jul 28, 2024 · 4 revisions
HELLO USER
Welcome to VFormOOPAPI's Wiki!!,
We will show you how to use it

What is this?

  • This is a menu virion created and developed by VennDev
  • It is similar to FormAPI in that there are 3 types of menus, which are:

Code in onEnable()

...
use venndev\vformoopapi\VFormLoader;

public function onEnable() : void{
 VFormLoader::init($this);
}
  • Note: if you do not add VFormLoader::init($this) to onEnable() then your chance of failure is up to 99.99%
  • In the latest version of VFormOOPAPI, you need to use YourClass::getInstance($player)->sendForm() instead of YourClass::send($player)

Example

YourFile.php

use venndev\vformoopapi\Form;
use venndev\vformoopapi\utils\TypeForm;
....

#[VForm(
  title: "Your Title",
  type: TypeForm::NORMAL_FORM
)]
class YourFile extends Form{
  use SingletonTrait;
  public function __construct(Player $player){
   parent::__construct($player);
  }
  //Your code in here...
}

YourCommandFile.php

use YourFile;

class YourCommandFile {
  //Your code...
  public function execute(CommandSender $sender, string $label, array $args){
   if($sender instanceof Player){
      YourFile::getInstance($player)->sendForm();
   }
  }
}
Clone this wiki locally