unexpected 'public function onPlayerGame'

Discussion in 'Plugin Help' started by Destroyer57, Dec 27, 2018.

  1. Destroyer57

    Destroyer57 Baby Zombie

    Messages:
    189
    I need help with my plugin here is the main code:

    public function onPlayerGameModeChangeEvent(PlayerGameModeChangeEvent $event){
    for($i = 0; $i getPlayer()->getInventory()->getSize(); $i++) { $event->getPlayer()->getInventory()->clear($i);
    }

    }

    Error:
    ,unexpected 'public function onPlayerGame' (T_STRING) , expecting function (T_FUNCTION) or const (T_CONST)" (EXCEPTION) in "Example.phar/src/Example/Example" at line 14

    Whats wrong with my code?
     
  2. SleepSpace9

    SleepSpace9 Witch

    Messages:
    59
    GitHub:
    sleepspace9
    Look at the second expression of your for loop, there's something missing...
    And why not simply using Inventory::clearAll() ? And maybe don't forget to clear armorInventory too.
     
    Last edited: Dec 27, 2018
    Muqsit likes this.

Share This Page

  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.