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

Solved Help me fix this plugin

Discussion in 'Plugin Help' started by Mochi, Jun 3, 2020.

  1. Mochi

    Mochi Baby Zombie

    Messages:
    113
    ReflectionException: "Class pocketmine\event\inventory\InventoryClickEvent does not exist" (EXCEPTION) in "src/pocketmine/plugin/PluginManager" at line 695

    Code :
    PHP:
    use pocketmine\inventory\{WindowInventoryChestInventory};
    use 
    pocketmine\even
    PHP:
     public function onMenu(InventoryClickEvent $ev){
            
    $p $ev->getPlayer();
            
    $window $ev->getInventory();
            if(
    $window instanceof WindowInventory){
                
    $ev->setCancelled();
                
    $window->close($p);
                
                
    $item $ev->getItem()->getCustomName();
                
                if(
    $item == "§r§eLight"){
                    if(
    $this->getParticleAvailable($p"flames") == "NoAvailable"){
                        if(
    $this->getCoins($p) >= 3000){
                            
    $this->remCoins($p3000);
                            
    $this->setParticleAvailable($p"flames");
                            
    $this->setParticle($p"flames");
                            
    $this->addGuardian($p);
                            
    $p->addTitle("§eLights""§aUnlocked!");
                            
    $p->sendMessage("§aYou successfully unlocked a particle §bLight§a!\n§7-3000 Coins");
                        }else{
                            
    $this->addSound($p47);
                            
    $p->sendMessage("§cУ вас нехватает ". (3000 $this->getCoins($p)) ." коинов чтобы приобрести данную частицу!");
                        }
                    }elseif(
    $this->getParticleAvailable($p"flames") == "Available"){
                        if(
    $this->getParticle($p) !== "flames"){
                            
    $this->setParticle($p"flames");
                            
    $this->addSound($p55);
                            
    $p->sendMessage("§aВы успешно активировали частицу §bОгоньки§a!");
                        }else{
                            
    $this->addSound($p47);
                            
    $p->sendMessage("§cУ вас уже активирована данная частица!");
                        }
                    }
                }
                if(
    $item == "§r§aДобрый житель"){
                    if(
    $this->getParticleAvailable($p"happyvillager") == "NoAvailable"){
                        if(
    $this->getCoins($p) >= 3000){
                            
    $this->remCoins($p3000);
                            
    $this->setParticleAvailable($p"happyvillager");
                            
    $this->setParticle($p"happyvillager");
                            
    $this->addGuardian($p);
                            
    $p->addTitle("§aВеселый житель""§aРазблокировано!");
                            
    $p->sendMessage("§aВы успешно разблокировали частицу §bВеселый житель§a!\n§7-3000 коинов");
                        }else{
                            
    $this->addSound($p47);
                            
    $p->sendMessage("§cУ вас нехватает ". (3000 $this->getCoins($p)) ." коинов чтобы приобрести данную частицу!");
                        }
                    }elseif(
    $this->getParticleAvailable($p"happyvillager") == "Available"){
                        if(
    $this->getParticle($p) !== "happyvillager"){
                            
    $this->setParticle($p"happyvillager");
                            
    $this->addSound($p55);
                            
    $p->sendMessage("§aВы успешно активировали частицу §bВеселый житель§a!");
                        }else{
                            
    $this->addSound($p47);
                            
    $p->sendMessage("§cУ вас уже активирована данная частица!");
                        }
                    }
                }
                if(
    $item == "§r§cСердечки"){
                    if(
    $this->getParticleAvailable($p"hearts") == "NoAvailable"){
                        if(
    $this->getCoins($p) >= 3000){
                            
    $this->remCoins($p3000);
                            
    $this->setParticleAvailable($p"hearts");
                            
    $this->setParticle($p"hearts");
                            
    $this->addGuardian($p);
                            
    $p->addTitle("§cСердечки""§aРазблокировано!");
                            
    $p->sendMessage("§aВы успешно разблокировали частицу §bСердечки§a!\n§7-3000 коинов");
                        }else{
                            
    $this->addSound($p47);
                            
    $p->sendMessage("§cУ вас нехватает ". (3000 $this->getCoins($p)) ." коинов чтобы приобрести данную частицу!");
                        }
                    }elseif(
    $this->getParticleAvailable($p"hearts") == "Available"){
                        if(
    $this->getParticle($p) !== "hearts"){
                            
    $this->setParticle($p"hearts");
                            
    $this->addSound($p55);
                            
    $p->sendMessage("§aВы успешно активировали частицу §bСердечки§a!");
                        }else{
                            
    $this->addSound($p47);
                            
    $p->sendMessage("§cУ вас уже активирована данная частица!");
                        }
                    }
                }
              if(
    $item == "§r§bЗлой житель"){
                    if(
    $this->getParticleAvailable($p"angryvillager") == "NoAvailable"){
                        if(
    $this->getCoins($p) >= 1000){
                            
    $this->remCoins($p1000);
                            
    $this->setParticleAvailable($p"angryvillager");
                            
    $this->setParticle($p"angryvillager");
                            
    $this->addGuardian($p);
                            
    $p->addTitle("§bЗлой Житель""§aРазблокировано!");
                            
    $p->sendMessage("§aВы успешно разблокировали частицу §bЗлой Житель§a!\n§7-1000 коинов");
                        }else{
                            
    $this->addSound($p47);
                            
    $p->sendMessage("§cУ вас нехватает ". (1000 $this->getCoins($p)) ." коинов чтобы приобрести данную частицу!");
                        }
                    }elseif(
    $this->getParticleAvailable($p"angryvillager") == "Available"){
                        if(
    $this->getParticle($p) !== "angryvillager"){
                            
    $this->setParticle($p"angryvillager");
                            
    $this->addSound($p55);
                            
    $p->sendMessage("§aВы успешно активировали частицу §bЗлой Житель§a!");
                        }else{
                            
    $this->addSound($p47);
                            
    $p->sendMessage("§cУ вас уже активирована данная §bчастица!");
                        }
                    }
                }
               if(
    $item == "§r§6Флейм"){
                    if(
    $this->getParticleAvailable($p"fire") == "NoAvailable"){
                        if(
    $this->getCoins($p) >= 20000){
                            
    $this->remCoins($p20000);
                            
    $this->setParticleAvailable($p"fire");
                            
    $this->setParticle($p"fire");
                            
    $this->addGuardian($p);
                            
    $p->addTitle("§6Флейм""§aРазблокировано!");
                            
    $p->sendMessage("§aВы успешно разблокировали частицу §6Файр§a!\n§7-20000 коинов");
                        }else{
                            
    $this->addSound($p47);
                            
    $p->sendMessage("§cУ вас нехватает ". (20000 $this->getCoins($p)) ." коинов чтобы приобрести данную частицу!");
                        }
                    }elseif(
    $this->getParticleAvailable($p"fire") == "Available"){
                        if(
    $this->getParticle($p) !== "fire"){
                            
    $this->setParticle($p"fire");
                            
    $this->addSound($p55);
                            
    $p->sendMessage("§aВы успешно активировали частицу §6Файр§a!");
                        }else{
                            
    $this->addSound($p47);
                            
    $p->sendMessage("§cУ вас уже активирована данная §bчастица!");
                        }
                    }
                }
              if(
    $item == "§r§dПортал"){
                    if(
    $this->getParticleAvailable($p"portal") == "NoAvailable"){
                        if(
    $this->getCoins($p) >= 5000){
                            
    $this->remCoins($p5000);
                            
    $this->setParticleAvailable($p"portal");
                            
    $this->setParticle($p"portal");
                            
    $this->addGuardian($p);
                            
    $p->addTitle("§dПортал""§aРазблокировано!");
                            
    $p->sendMessage("§aВы успешно разблокировали частицу §dПортал§a!\n§7-5000 коинов");
                        }else{
                            
    $this->addSound($p47);
                            
    $p->sendMessage("§cУ вас нехватает ". (5000 $this->getCoins($p)) ." коинов чтобы приобрести данную частицу!");
                        }
                    }elseif(
    $this->getParticleAvailable($p"portal") == "Available"){
                        if(
    $this->getParticle($p) !== "portal"){
                            
    $this->setParticle($p"portal");
                            
    $this->addSound($p55);
                            
    $p->sendMessage("§aВы успешно активировали частицу §dПортал§a!");
                        }else{
                            
    $this->addSound($p47);
                            
    $p->sendMessage("§cУ вас уже активирована данная §bчастица!");
                        }
                    }
                }
                if(
    $item == "§r§cОтключить частицы"){
                    if(
    $this->getParticle($p) !== "none"){
                        
    $this->setParticle($p"none");
                        
    $this->addSound($p55);
                        
    $p->sendMessage("§eВы успешно §cотключили §eчастицы!");
                    }else{
                        
    $this->addSound($p47);
                        
    $p->sendMessage("§cУ вас отключены частицы!");
                    }
                }
            }
        }
     
  2. Mochi

    Mochi Baby Zombie

    Messages:
    113
    And this

    Code:

    PHP:
    public function openMenu(Player $pstring $category){
            if(
    $category == "particles"){
                
    $window = new class($p"§5* §fМагазин партиклов §5*") extends WindowInventory
                
    {
                    public function 
    __construct(Player $pstring $customName ""){
                        
    parent::__construct($p$customName);
                        
    $this->$p;
                        
                        
    $pk = new AddEntityPacket();
                        
    $pk->entityRuntimeId $this->entityRuntimeId Entity::$entityCount++;
                        
    $pk->type 15;
                        
    $pk->metadata = [
                        
    Entity::DATA_SCALE => [Entity::DATA_TYPE_FLOAT0],
                        ];
                        
    $pk->$this->p->x;
                        
    $pk->$this->p->y;
                        
    $pk->$this->p->z;
                        
    $this->p->dataPacket($pk);
                    }
                };
                
                
    $window->setItem(10Item::get(37701)->setCustomName("§r§eОгоньки"));
                
    $window->setItem(11Item::get(351101)->setCustomName("§r§aДобрый житель"));
                
    $window->setItem(12Item::get(35111)->setCustomName("§r§cСердечки"));
                
    $window->setItem(13Item::get(38511)->setCustomName("§r§bЗлой житель"));
                
    $window->setItem(14Item::get(5111)->setCustomName("§r§6Флейм"));
                
    $window->setItem(15Item::get(9011)->setCustomName("§r§dПортал"));
                
    $window->setItem(16Item::get(6311)->SetCustomName("§r§cСкоро..."));

                
    $window->setItem(52Item::get(35181)->setCustomName("§r§cОтключить частицы"));
                
    $window->setItem(53Item::get(35141)->setCustomName("§r§cВыйти"));
                
    $p->addWindow($window);
            }
        }
     
  3. HiToLaKhanh

    HiToLaKhanh Spider Jockey

    Messages:
    25
    GitHub:
    HiToLaKhanh
    what is this???
     
  4. HiToLaKhanh

    HiToLaKhanh Spider Jockey

    Messages:
    25
    GitHub:
    HiToLaKhanh
    PHP:
    use pocketmine\event\inventory\InventoryTransactionEvent; \\instead
     
  5. Mochi

    Mochi Baby Zombie

    Messages:
    113
    Sorry typo
     
  6. Mochi

    Mochi Baby Zombie

    Messages:
    113
    U
    Use that??
     
  7. Mochi

    Mochi Baby Zombie

    Messages:
    113
    Can you give the code please
     
  8. HiToLaKhanh

    HiToLaKhanh Spider Jockey

    Messages:
    25
    GitHub:
    HiToLaKhanh
    replace on use statement
    and change this
    to
    PHP:
    InventoryTransactionEvent
     
  9. BenMenEs

    BenMenEs Creeper

    Messages:
    5
    русским привет
     
  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.