Is there anything I need to do, like construct or need i do nothing just create a new file with everything like use poc... and class main extends...?
When creating a class you have to construct the main class: PHP: use yourplugin\MainClass;Class SecondClass { Public $plugin; Public function __construct(MainClass $main) { $this->plugin = $main; } Public function getPlugin() { // This function can be used to call methods from the main class. It is optional, u can just use $this->plugin directly. return $this->plugin; }} Now if u wanted to use methods from the second class in your main class: PHP: Use yourplugin\SecondClass;class MainClass extends PluginBase { public function getSecondClass() { // Optional functio . You could just use 'new SecondClass($this); directly Return new SecondClass($this); } // Public function onJoin(PlayerJoinEvent $event) { $this->getSecondClass()->yourMethodHere();}
The problem is, why do you want to create another class (the concept is another class, not another file)? Creating multiple classes is an actual practice in object-oriented programming, not merely to make the files look neater.