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

Error in MyPlugin Created

Comments in 'Plugin Development' started by Palente, Apr 14, 2016.

  1. Palente
    Offline

    Palente New Member

    Joined:
    Jan 16, 2016
    Posts:
    9
    Minecraft User:
    Palente
    Hi I'm French and i have doing a Plugin But when i launch PocketMine with My Plugin(with DevTools) I have all the time an error. Please can you help me
    This is my Plugin it is easy because i start in the création of plugins and is it so difficulte and i can't see vidéo with this title because i'm french turn to the problem

    <?php
    /*
    @Name Advert
    @main Palente\Advert\Class
    @version 1.0.0
    @api 1.13.1
    @author Palente
    */
    namespace Palente\Advert ;
    use PocketMine\Plugin\PluginBase ;
    class Advert\PluginBase {
    public function onEnable () {
    $this->getLogger()->info ("onEnable () has been called!") ;
    }
    $this->getLogger()->info ("onDisable () has been called!") ;
    }
    }






    And this is the error in Pocket Mine
    [PocketMine] Server is starting...
    [PocketMine] Server was started.
    [Server] [02:52:06] [Server thread/WARNING]: Timezone could not be automatically determined. An incorrect timezone will result in incorrect timestamps on console logs. It has been set to "UTC" by default. You can change it on the php.ini file.
    [Server] [02:52:06] [Server thread/INFO]: Loading pocketmine.yml...
    [Server] [02:52:06] [Server thread/INFO]: Loading server properties...
    [Server] [02:52:06] [Server thread/INFO]: Enable MainLogger to file
    [Server] [02:52:06] [Server thread/INFO]: Selected English (eng) as the base language
    [Server] [02:52:06] [Server thread/INFO]: Starting Minecraft: PE server version v0.14.x beta/alpha
    [Server] [02:52:09] [Server thread/INFO]: Enabling DevTools v1.10.0
    [Server] [02:52:09] [Server thread/INFO]: Loading source plugin Advert v1.0.0
    [Server]
    [Server] Fatal error: Namespace declaration statement has to be the very first statement in the script in /storage/emulated/0/PocketMine/plugins/Advert/src/Advert/Advert.php on line 10
  2. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    Do you not have plugin.yml? You seems to have added details in the main class instead of plugin.yml.
  3. Palente
    Offline

    Palente New Member

    Joined:
    Jan 16, 2016
    Posts:
    9
    Minecraft User:
    Palente
    I do that
    This is my plugin.yml is a easy i start in code
    name: Advert
    main: Advert\Advert
    version: 1.0.0
    api: 1.12.1

    namespace: Palente\Advert ;
    use: PocketMine\Plugin\PluginBase ;
    class: Advert\PluginBase {
    public function onEnable () {
    $this->getLogger()->info ("onEnable () has been called!") ;
    }
    $this->getLogger()->info ("onDisable () has been called!") ;
    }
    }
    Error:


    [Server] [03:19:27] [Server thread/INFO]: Enabling DevTools v1.10.0
    [Server] [03:19:27] [Server thread/ERROR]: Could not load '/storage/emulated/0/PocketMine/plugins/Advert' in folder '/storage/emulated/0/PocketMine/plugins/': yaml_parse(): scanning error encountered during parsing: could not find expected ':' (line 10, column 1), context while scanning a simple key (line 9, column 1)
    [Server] [03:19:27] [Server thread/WARNING]: RuntimeException: "yaml_parse(): scanning error encountered during parsing: could not find expected ':' (line 10, column 1), context while scanning a simple key (line 9, column 1)" (E_WARNING) in "/src/pocketmine/plugin/PluginDescription" at line 2
    What I can do please :(
  4. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    What is this?
    Code:
    namespace: Palente\Advert;
    use: PocketMine\Plugin\PluginBase;
    class: Advert\PluginBase
    
    KubixQ and jojoe77777 like this.
  5. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
    *palmface*
    I'm telling you nicely: go learn PHP
  6. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    He created snippet plugin where you have to show plugin.yml info above
    PHP:
    /**
     * @name Plugin
     * @author
     * @...
     */
  7. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    Oh right, I thought he was following how old .php plugins were made. Either way, this is poorly written.
    MCPEPIG likes this.
  8. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Just in case: <?php needs to be on the first line

Share This Page

Advertisement