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

My UI Problem

Discussion in 'Help' started by MCForever5, Apr 5, 2020.

  1. MCForever5

    MCForever5 Silverfish

    Messages:
    17
    What wrong i i did for my Plugin?Please help me,thank you.
    PHP:
    <?php
    namespace RxDuZ\Events;
    use 
    pocketmine\Server;
    use 
    pocketmine\Player;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\utils\Config;
    use 
    pocketmine\utils\TextFormat as Color;
    use 
    RxDuZ\Main;

    class 
    Gadgets {
        private 
    $p;
        public function 
    __construct(Main $p){
                
    $this->pl $p;
                
    $this->pc $this->pl->getServer()->getPluginManager()->getPlugin("PureChat");
        }
        
        public function 
    onFly(Player $pl) {
            
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                if(
    $pl->isFlying()) {
                    
    $pl->sendMessage($cfg->get("prefix") . Color::RED " FLY DISABLED");
                    
    $pl->setFlying(false);
                    
    $pl->setAllowFlight(false);
                } else {
                    
    $pl->setAllowFlight(true);
                    
    $pl->sendMessage($cfg->get("prefix") . Color::GREEN " FLY ENABLED");
                    }
            }
            
        public function 
    openGad(Player $player){
            
    $api $this->pl->getServer()->getPluginManager()->getPlugin("FormAPI");
             
    $f $api->createSimpleForm(function(Player $ev, ?int $data null){
                
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                 
    $player $ev->getPlayer();
                 if(isset(
    $data)){
                switch(
    $data){
                        case 
    0:
                        if(!
    $player->hasPermission("fly.get")) {
                        
    $player->sendMessage($cfg->get("prefix") . Color::RED " You need to be §bVIP^ §4to Unlock This Ability");
                        return 
    false;
                        }
                        
    $this->onFly($player);
                        break;
                        case 
    1:
                        if(!
    $player->hasPermission("tag.get")) {
                        
    $player->sendMessage($cfg->get("prefix") . Color::RED " You need to be §eKing§aGamer^ §4to Unlock Colour This Ability");
                        return 
    false;
                        }
                        
    $this->tagColor($player);
                        break;
                        case 
    2:
                        if(!
    $player->hasPermission("size.get")) {
                        
    $player->sendMessage($cfg->get("prefix") . Color::RED " You need to be  §6MVP^ §4to Unlock This Ability");
                        return 
    false;
                        }
                        
    $this->onSize($player);
                        break;
                        case 
    3:
                        if(!
    $player->hasPermission("time.get")) {
                        
    $player->sendMessage($cfg->get("prefix") . Color::RED " Only for Developer or Admin");
                        return 
    false;
                        }
                        
    $this->onTime($player);
                        break;
                        case 
    4:
                        
    // Closed
                        
    break;
                   }
                }
            });
            
            
    $f->setTitle(Color::YELLOW "Gloabal Setting");
            
    $f->addButton(Color::AQUA "Fly"0"textures/items/feather");
            
    $f->addButton(Color::AQUA "Colour Name"0"textures/items/egg_npc");
            
    $f->addButton(Color::AQUA "Size"0"textures/items/totem");
            
    $f->addButton(Color::AQUA "Time"0"textures/items/clock_item");
            
    $f->addButton(Color::BOLD Color::RED "EXIT",0,"textures/ui/redX1");     
            
    $f->sendToPlayer($player);
        }
        
        public function 
    tagColor(Player $player){
            
    $api $this->pl->getServer()->getPluginManager()->getPlugin("FormAPI");
             
    $f $api->createSimpleForm(function(Player $ev, ?int $data null){
                
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                 
    $player $ev->getPlayer();
                 if(isset(
    $data)){
                switch(
    $data){
                        case 
    0:
                        
    $name $player->getName();
                        
    $player->setNameTag(Color::AQUA $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " Your name Colour has been changed to" Color::AQUA " Aqua");
                        break;
                        case 
    1:
                        
    $name $player->getName();
                        
    $player->setNameTag(Color::GOLD $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " Your name Colour has been changed to" Color::GOLD " Gold");
                        break;
                        case 
    2:
                        
    $name $player->getName();
                        
    $player->setNameTag(Color::YELLOW $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " Your name Colour has been changed to" Color::YELLOW " Yellow");
                        break;
                        case 
    3:
                        
    $name $player->getName();
                        
    $player->setNameTag(Color::LIGHT_PURPLE $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " Your name Colour has been changed to" Color::LIGHT_PURPLE " Pink");
                        break;
                        case 
    4:
                        
    $name $this->->getName();
                        
    $player->setNameTag(Color::GREEN $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " Your name Colour has been changed to" Color::GREEN "Green");
                        break;
                        case 
    5:
                        
    $name $player->getName();
                        
    $player->setNameTag(Color::DARK_PURPLE $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " Your name Colour has been changed to" Color::DARK_PURPLE " Purple");
                        break;
                        case 
    6:
                        
    $name $player->getName();
                        
    $player->setNameTag(Color::RED $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::RED " Your name Colour has been changed to" Color::RED " Red");
                        break;
                        case 
    7:
                        
    $prefix $this->pc->getNametag($player);
                        
    $player->setNameTag($prefix);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GRAY " Colour name has been" Color::RED " DISABLED");
                        break;
                        case 
    8:
                        
    // Closed
                        
    break;
                   }
                }
            });
            
            
    $f->setTitle(Color::GRAY "Colour Name");
            
    $f->setContent("Choose any Colour you want in below");
            
    $f->addButton(Color::AQUA "Blue");
            
    $f->addButton(Color::GOLD "Gold");
            
    $f->addButton(Color::YELLOW "Yellow");
            
    $f->addButton(Color::LIGHT_PURPLE "Pink");
            
    $f->addButton(Color::GREEN "Green");
            
    $f->addButton(Color::DARK_PURPLE "Purple");
            
    $f->addButton(Color::RED "Red");
            
    $f->addButton(Color::GRAY "None");
            
    $f->addButton(Color::BOLD Color::RED "EXIT");
            
    $f->sendToPlayer($player);
        }
        
        public function 
    onTime(Player $player){
            
    $api $this->pl->getServer()->getPluginManager()->getPlugin("FormAPI");
             
    $f $api->createSimpleForm(function(Player $ev, ?int $data null){
                
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                 
    $player $ev->getPlayer();
                 if(isset(
    $data)){
                switch(
    $data){
                        case 
    0:
                        
    $player->getLevel()->setTime(1000);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " You changed Server Time to" Color::YELLOW " Day");
                        break;
                        case 
    1:
                        
    $player->getLevel()->setTime(25000);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " You changed Server Time to" Color::DARK_PURPLE " Night");
                        break;
                        case 
    2:
                        
    // Closed
                        
    break;
                   }
                }
            });
            
            
    $f->setTitle(Color::GRAY "Time");
            
    $f->setContent("Set the Time of World");
            
    $f->addButton(Color::YELLOW "Day");
            
    $f->addButton(Color::DARK_PURPLE "Night");
            
    $f->addButton(Color::BOLD Color::RED "EXIT");
            
    $f->sendToPlayer($player);
        }
        
        public function 
    onSize(Player $player){
            
    $api $this->pl->getServer()->getPluginManager()->getPlugin("FormAPI");
             
    $f $api->createSimpleForm(function(Player $ev, ?int $data null){
                
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                 
    $player $ev->getPlayer();
                 if(isset(
    $data)){
                switch(
    $data){
                        case 
    0:
                        
    $player->setScale(0.2);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " You changed your Size into" Color::YELLOW " Mini Size");
                        break;
                        case 
    1:
                        
    $player->setScale(1);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " You changed your Size into" Color::YELLOW " Normal Size");
                        break;
                        case 
    2:
                        
    $player->setScale(3.5);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " You changed your Size into" Color::YELLOW " Huge Size");
                        break;
                        case 
    3:
                        
    // Closed
                        
    break;
                   }
                }
            });
            
            
    $f->setTitle(Color::GRAY "Size");
            
    $f->setContent("Change your Current Size");
            
    $f->addButton(Color::GREEN "Mini Size");
            
    $f->addButton(Color::GREEN "Normal Size");
            
    $f->addButton(Color::GREEN "Huge Size");
            
    $f->addButton(Color::BOLD Color::RED "EXIT");
            
    $f->sendToPlayer($player);
        }

    }  
     
    NutXzG likes this.
  2. MCForever5

    MCForever5 Silverfish

    Messages:
    17
    Please help me,thank you.
     
  3. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    What is Error
    ==========
    Bad English
    ==========
     
  4. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    I think I know Your Problem
    PHP:
    public function openGad(Player $player){
            
    $api $this->pl->getServer()->getPluginManager()->getPlugin("FormAPI");
             
    $f $api->createSimpleForm(function(Player $player, ?int $data null){
                
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                 if(isset(
    $data)){
                switch(
    $data){
    PHP:
    public function tagColor(Player $player){
            
    $api $this->pl->getServer()->getPluginManager()->getPlugin("FormAPI");
             
    $f $api->createSimpleForm(function(Player $player, ?int $data null){
                
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                 if(isset(
    $data)){
                switch(
    $data){
    PHP:
    public function onTime(Player $player){
            
    $api $this->pl->getServer()->getPluginManager()->getPlugin("FormAPI");
             
    $f $api->createSimpleForm(function(Player $player, ?int $data null){
                
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                 if(isset(
    $data)){
                switch(
    $data){
    PHP:
    public function onSize(Player $player){
            
    $api $this->pl->getServer()->getPluginManager()->getPlugin("FormAPI");
             
    $f $api->createSimpleForm(function(Player $player, ?int $data null){
                
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                 if(isset(
    $data)){
                switch(
    $data){
    Do you know to change on line I edit
     
  5. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    (Bad English )
     
  6. MCForever5

    MCForever5 Silverfish

    Messages:
    17
    Which line you changed?xD please underline it if can
     
  7. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    Here:
    PHP:
    <?php
    namespace RxDuZ\Events;
    use 
    pocketmine\Server;
    use 
    pocketmine\Player;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\utils\Config;
    use 
    pocketmine\utils\TextFormat as Color;
    use 
    RxDuZ\Main;

    class 
    Gadgets {
        private 
    $p;
        public function 
    __construct(Main $p){
                
    $this->pl $p;
                
    $this->pc $this->pl->getServer()->getPluginManager()->getPlugin("PureChat");
        }
      
        public function 
    onFly(Player $pl) {
            
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                if(
    $pl->isFlying()) {
                    
    $pl->sendMessage($cfg->get("prefix") . Color::RED " FLY DISABLED");
                    
    $pl->setFlying(false);
                    
    $pl->setAllowFlight(false);
                } else {
                    
    $pl->setAllowFlight(true);
                    
    $pl->sendMessage($cfg->get("prefix") . Color::GREEN " FLY ENABLED");
                    }
            }
          
        public function 
    openGad(Player $player){
            
    $api $this->pl->getServer()->getPluginManager()->getPlugin("FormAPI");
             
    $f $api->createSimpleForm(function(Player $ev, ?int $data null){
                
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                  
    $player $ev;
                 if(isset(
    $data)){
                switch(
    $data){
                        case 
    0:
                        if(!
    $player->hasPermission("fly.get")) {
                        
    $player->sendMessage($cfg->get("prefix") . Color::RED " You need to be §bVIP^ §4to Unlock This Ability");
                        return 
    false;
                        }
                        
    $this->onFly($player);
                        break;
                        case 
    1:
                        if(!
    $player->hasPermission("tag.get")) {
                        
    $player->sendMessage($cfg->get("prefix") . Color::RED " You need to be §eKing§aGamer^ §4to Unlock Colour This Ability");
                        return 
    false;
                        }
                        
    $this->tagColor($player);
                        break;
                        case 
    2:
                        if(!
    $player->hasPermission("size.get")) {
                        
    $player->sendMessage($cfg->get("prefix") . Color::RED " You need to be  §6MVP^ §4to Unlock This Ability");
                        return 
    false;
                        }
                        
    $this->onSize($player);
                        break;
                        case 
    3:
                        if(!
    $player->hasPermission("time.get")) {
                        
    $player->sendMessage($cfg->get("prefix") . Color::RED " Only for Developer or Admin");
                        return 
    false;
                        }
                        
    $this->onTime($player);
                        break;
                        case 
    4:
                        
    // Closed
                        
    break;
                   }
                }
            });
          
            
    $f->setTitle(Color::YELLOW "Gloabal Setting");
            
    $f->addButton(Color::AQUA "Fly"0"textures/items/feather");
            
    $f->addButton(Color::AQUA "Colour Name"0"textures/items/egg_npc");
            
    $f->addButton(Color::AQUA "Size"0"textures/items/totem");
            
    $f->addButton(Color::AQUA "Time"0"textures/items/clock_item");
            
    $f->addButton(Color::BOLD Color::RED "EXIT",0,"textures/ui/redX1");   
            
    $f->sendToPlayer($player);
        }
      
        public function 
    tagColor(Player $player){
            
    $api $this->pl->getServer()->getPluginManager()->getPlugin("FormAPI");
             
    $f $api->createSimpleForm(function(Player $ev, ?int $data null){
                
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                 
    $player $ev;
                 if(isset(
    $data)){
                switch(
    $data){
                        case 
    0:
                        
    $name $player->getName();
                        
    $player->setNameTag(Color::AQUA $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " Your name Colour has been changed to" Color::AQUA " Aqua");
                        break;
                        case 
    1:
                        
    $name $player->getName();
                        
    $player->setNameTag(Color::GOLD $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " Your name Colour has been changed to" Color::GOLD " Gold");
                        break;
                        case 
    2:
                        
    $name $player->getName();
                        
    $player->setNameTag(Color::YELLOW $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " Your name Colour has been changed to" Color::YELLOW " Yellow");
                        break;
                        case 
    3:
                        
    $name $player->getName();
                        
    $player->setNameTag(Color::LIGHT_PURPLE $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " Your name Colour has been changed to" Color::LIGHT_PURPLE " Pink");
                        break;
                        case 
    4:
                        
    $name $this->->getName();
                        
    $player->setNameTag(Color::GREEN $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " Your name Colour has been changed to" Color::GREEN "Green");
                        break;
                        case 
    5:
                        
    $name $player->getName();
                        
    $player->setNameTag(Color::DARK_PURPLE $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " Your name Colour has been changed to" Color::DARK_PURPLE " Purple");
                        break;
                        case 
    6:
                        
    $name $player->getName();
                        
    $player->setNameTag(Color::RED $name);
                        
    $player->sendMessage($cfg->get("prefix") . Color::RED " Your name Colour has been changed to" Color::RED " Red");
                        break;
                        case 
    7:
                        
    $prefix $this->pc->getNametag($player);
                        
    $player->setNameTag($prefix);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GRAY " Colour name has been" Color::RED " DISABLED");
                        break;
                        case 
    8:
                        
    // Closed
                        
    break;
                   }
                }
            });
          
            
    $f->setTitle(Color::GRAY "Colour Name");
            
    $f->setContent("Choose any Colour you want in below");
            
    $f->addButton(Color::AQUA "Blue");
            
    $f->addButton(Color::GOLD "Gold");
            
    $f->addButton(Color::YELLOW "Yellow");
            
    $f->addButton(Color::LIGHT_PURPLE "Pink");
            
    $f->addButton(Color::GREEN "Green");
            
    $f->addButton(Color::DARK_PURPLE "Purple");
            
    $f->addButton(Color::RED "Red");
            
    $f->addButton(Color::GRAY "None");
            
    $f->addButton(Color::BOLD Color::RED "EXIT");
            
    $f->sendToPlayer($player);
        }
      
        public function 
    onTime(Player $player){
            
    $api $this->pl->getServer()->getPluginManager()->getPlugin("FormAPI");
             
    $f $api->createSimpleForm(function(Player $ev, ?int $data null){
                
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                 
    $player $ev;
                 if(isset(
    $data)){
                switch(
    $data){
                        case 
    0:
                        
    $player->getLevel()->setTime(1000);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " You changed Server Time to" Color::YELLOW " Day");
                        break;
                        case 
    1:
                        
    $player->getLevel()->setTime(25000);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " You changed Server Time to" Color::DARK_PURPLE " Night");
                        break;
                        case 
    2:
                        
    // Closed
                        
    break;
                   }
                }
            });
          
            
    $f->setTitle(Color::GRAY "Time");
            
    $f->setContent("Set the Time of World");
            
    $f->addButton(Color::YELLOW "Day");
            
    $f->addButton(Color::DARK_PURPLE "Night");
            
    $f->addButton(Color::BOLD Color::RED "EXIT");
            
    $f->sendToPlayer($player);
        }
      
        public function 
    onSize(Player $player){
            
    $api $this->pl->getServer()->getPluginManager()->getPlugin("FormAPI");
             
    $f $api->createSimpleForm(function(Player $ev, ?int $data null){
                
    $cfg = new Config($this->pl->getDataFolder() . "config.yml"Config::YAML);
                 
    $player $ev;
                 if(isset(
    $data)){
                switch(
    $data){
                        case 
    0:
                        
    $player->setScale(0.2);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " You changed your Size into" Color::YELLOW " Mini Size");
                        break;
                        case 
    1:
                        
    $player->setScale(1);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " You changed your Size into" Color::YELLOW " Normal Size");
                        break;
                        case 
    2:
                        
    $player->setScale(3.5);
                        
    $player->sendMessage($cfg->get("prefix") . Color::GREEN " You changed your Size into" Color::YELLOW " Huge Size");
                        break;
                        case 
    3:
                        
    // Closed
                        
    break;
                   }
                }
            });
          
            
    $f->setTitle(Color::GRAY "Size");
            
    $f->setContent("Change your Current Size");
            
    $f->addButton(Color::GREEN "Mini Size");
            
    $f->addButton(Color::GREEN "Normal Size");
            
    $f->addButton(Color::GREEN "Huge Size");
            
    $f->addButton(Color::BOLD Color::RED "EXIT");
            
    $f->sendToPlayer($player);
        }

    }
     
  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.