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

Effect

Discussion in 'Development' started by Flow, Apr 14, 2019.

  1. Flow

    Flow Silverfish

    Messages:
    22
    This code is valid ? :
    <?php

    namespace JStick;

    use pocketmine\plugin\PluginBase;
    use pocketmine\event\Listener;
    use pocketmine\Player;
    use pocketmine\Server;
    use pocketmine\item\Item;
    use pocketmine\utils\TextFormat as C;
    use pocketmine\event\player\PlayerInteractEvent;

    class Main extends PluginBase implements Listener{

    public function onEnable(){
    $this->getServer()->getPluginManager()->registerEvents($this,$this);
    $this->getLogger()->info(C::GREEN . "Connecter");
    }

    public function onInteract(PlayerInteractEvent $ev){
    $p = $ev->getPlayer();
    $i = Item::SLIMEBALL
    $eff = new EffectInstance(Effect::getEffect(Effect::JUMP_BOOST));
    $eff->setDuration(20*20);
    $item = $p->getInventory()->getItemInHand();
    if($item->getId() == $i){
    $p->addEffect($eff);
    }
    }
    }
     
  2. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    we are not a PHP or PMMP tester, just try it
     
  3. Flow

    Flow Silverfish

    Messages:
    22
    it is to know if there are no faults
     
  4. Flow

    Flow Silverfish

    Messages:
    22
    [20:05:18] [Server thread/INFO]: Chargement JStickFlow v1.0.0
    [20:05:18] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected '$effect' (T_VARIABLE)" (EXCEPTION) in "plugins/JStick/src/JStick/Main" at line 23
    [20:05:18] [Server thread/DEBUG]: #0 (): BaseClassLoader->loadClass(string JStick\Main)
    [20:05:18] [Server thread/DEBUG]: #1 (): spl_autoload_call(string JStick\Main)
    [20:05:18] [Server thread/DEBUG]: #2 src/pocketmine/plugin/PluginManager(178): class_exists(string JStick\Main, boolean 1)
    [20:05:18] [Server thread/DEBUG]: #3 src/pocketmine/plugin/PluginManager(343): pocketmine\plugin\PluginManager->loadPlugin(string /root/plugins/JStick, array Array())
    [20:05:18] [Server thread/DEBUG]: #4 plugins/PocketMine-DevTools.phar/src/DevTools/DevTools(49): pocketmine\plugin\PluginManager->loadPlugins(string /root/plugins/, array Array())
    [20:05:18] [Server thread/DEBUG]: #5 src/pocketmine/plugin/PluginBase(123): DevTools\DevTools->onEnable()
    [20:05:18] [Server thread/DEBUG]: #6 src/pocketmine/plugin/PluginManager(587): pocketmine\plugin\PluginBase->setEnabled(boolean 1)
    [20:05:18] [Server thread/DEBUG]: #7 src/pocketmine/Server(1983): pocketmine\plugin\PluginManager->enablePlugin(DevTools\DevTools object)

    This error.
     
  5. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    it seems like this is a common issue to new developers, and can be solved by trying to find a relevant section in https://bit.ly/PmDev.

    Short Answer: you missed a semicolon in
    PHP:
     $i Item::SLIMEBALL 
     
  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.