How to call another file - PluginsByMe/ffr GitHub Wiki

so when doing new

instead of this for example

use Zero\WorldTpUI\UI\ListenerUI;


$this->getServer()->getPluginManager()->registerEvents(new ListenerUI($this), $this);

you can save time by just doing

$this->getServer()->getPluginManager()->registerEvents(new \Zero\WorldTpUI\UI\ListenerUI($this), $this);

of course you do need the \ in front of it like \Zero\WorldTpUI\UI\ListenerUI instead of Zero\WorldTpUI\UI\ListenerUI

but what I have found it doing that makes the top of your plugin look cleaner in some areas, but it is not always good to do that, like when dealing with player or entity stuff its best to just do use at the top for them, but events are best for it

EX.

public function onPacketReceived(\pocketmine\event\server\DataPacketReceiveEvent $event){

and ya you also can do this

$ui = new \Zero\WorldTpUI\UI\CustomUI($id);

but u need to pass the data in when your defining it, if your using a construct with it

if the file/class your calling does not have a construct in it you can just do this

$ui = new \Zero\WorldTpUI\UI\CustomUI