Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Could not pass Event

Comments in 'Plugin Development' started by Skullex, Apr 4, 2016.

  1. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Everytime I drop and then pickup the Item::EMERALD I get this error in the console

    Code:
    [18:12:10] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerDropItemEvent' to 'TeamsManager v1.0 DEV': Class Team\Teams\Item not found on Team\Teams\TeamMain
    [18:12:10] [Server thread/CRITICAL]: ClassNotFoundException: "Class Team\Teams\Item not found" (EXCEPTION) in "/src/spl/BaseClassLoader" at line 144
    
    
    [18:12:13] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\inventory\InventoryPickupItemEvent' to 'TeamsManager v1.0 DEV': Call to undefined method pocketmine\event\inventory\InventoryPickupItemEvent::getPlayer() on Team\Teams\TeamMain
    [18:12:13] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\event\inventory\InventoryPickupItemEvent::getPlayer()" (EXCEPTION) in "/TeamsManager-master/src/Team/Teams/TeamMain" at line 44
    
    Here is the code

    PHP:
    public function onPickup(InventoryPickupItemEvent $event){
            
    $player $event->getPlayer();
            
    $fizz = new AnvilFallSound($player);
            
    $player->getLevel()->addSound($fizz);
            
    $amount $this->cf["MoneyAmount"];
            
    $this->economyAPI->addMoney($player$amount);
            
    $this->PlayerFile->set("EXP",$amount);
            
    $this->PlayerFile->save();
        }
       
        public function 
    onDrop(PlayerDropItemEvent $event){
            
    $player $event->getPlayer();
            if(
    $player->getInventory()->getItemInHand()->getId() === Item::EMERALD){
                
    $event->setCancelled(true);
            }
        }
    What did I do wrong??
  2. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    You did not
    PHP:
    use pocketmine\item\Item;
    Skullex likes this.
  3. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Thanks

Share This Page

Advertisement