1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

2 Files Connect

Discussion in 'Help' started by Robin, May 16, 2020.

  1. Robin

    Robin Spider

    Messages:
    11
    GitHub:
    Blackbarbar
    hey i need help.

    i am coding a Shop UI Plugin and now i have a big problem.

    My main file called Main.php and my shop file called Shop.php

    How can i connect these 2 files?

    In the Main file i had write the UI Basics (openShopForm)


    In the Shop File i had write the Shop form, but this form don't open.

    Thanks for help

    Good Day ;)
     
  2. folosinod71962

    folosinod71962 Silverfish

    Messages:
    23
    You Mean Like When a Player Types The Shop Command?
    Shop.php
    PHP:
    public function Shop() {
    $api $this->getServer()->getPluginManager()->getPlugin("FormAPI"//Getting The Plugin
    $form $api->createSimpleForm(

    }
    And Now To Call It You Must Use The "Use" Statment
    Main.php
    PHP:
    <?php

    Namespace AuthorName\PluginName;

    use 
    pocketmine\Player;
    use 
    pocketmine\plugin\PluginBase;
    use 
    AuthorName\PluginName\Shop;
    //didn't include all use statments like Command Sender And Whatsoever cuz im too lazy.
    public function Main extends PluginBase {
       public function 
    onCommand(CommandSender $senderCommand $cmdstring $label, array $args) {
    switch(
    $cmd->getName()) {
          case 
    "Test":
          
    // To Call it You Must Use "New " And The Class Name. Ex:
          
    new Shop($sender);
          break;
          return 
    true;
    }
    return 
    true;
    }
    return 
    true;
    }
    Thats all.
     
    Last edited: May 30, 2020
    Primus and RicardoMilos384 like this.
  3. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    Primus likes this.
  4. Robin

    Robin Spider

    Messages:
    11
    GitHub:
    Blackbarbar
    Hey now I have a another question

    how can I add a new Item like a Super-Log with the Texture like a log u know ?
     
  5. Primus

    Primus Zombie Pigman

    Messages:
    749
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.