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

Unknown dependency

Comments in 'Plugin Development' started by Andrey Nazarchuk, May 12, 2015.

  1. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    After trying to load a plugin (not from a phar, but from source code) This error happend:

    Code:
    15:49:30 [CRITICAL] Could not load plugin 'SkyWarsPE': Unknown dependency
    15:49:30 [CRITICAL] Could not load plugin 'SkyWarsPE': Circular dependency detected
    
    Here are the dependencies:
    Code:
    use pocketmine\command\Command;
    use pocketmine\command\CommandSender;
    use pocketmine\command\CommandExecutor;
    use pocketmine\command\PluginCommand;
    use pocketmine\Player;
    use pocketmine\plugin\PluginBase;
    use pocketmine\plugin\Listener;
    use pocketmine\plugin\Plugin;
    use pocketmine\level\Level;
    use pocketmine\event\player\BlockBreakEvent;
    use pocketmine\event\player\PlayerJoinEvent;
    use pocketmine\event\player\BlockPlaceEvent;
    use pocketmine\event\player\PlayerChatEvent;
    use pocketmine\event\player\PlayerInteractEvent;
    use pocketmine\event\player\PlayerDeathEvent;
    use pocketmine\event\entity\EntityDamageEvent;
    use pocketmine\event\entity\EntityDamageByEntityEvent;
    use pocketmine\event\entity\EntityLevelChangeEvent;
    use pocketmine\event\EventExecutor;
    use pocketmine\event\EventPriority;
    use pocketmine\event\Listener;
    use pocketmine\math\Vector3;
    use pocketmine\utils\Config;
    use pocketmine\utils\TextFormat;
    use pocketmine\scheduler\PluginTask;
    use pocketmine\Server;
    use pocketmine\item\Item;
    
    Which dependencies are outdated/"curcualar"?
    Thanks!:D
    Last edited: May 13, 2015
  2. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    Can I see the plugin.yml?
    Andrey Nazarchuk likes this.
  3. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Sure:

    Code:
    name: SkyWarsPE
    version: COREv1.0.0
    api: 1.12.0
    main: SkyWarsPE\Main
    author: Hidden
    description: SkyWarsPE, Custom SkyWars plugin
    website: Hidden
    depend: SkyWarsPE
    commands:
    sw:
      description: "Info"
      usage: "/sw"
      permission: matrixpe.sw
    ss:
      description: "Set a Player spawn"
      usage: "/ss"
      permission: matrixpe.ss
    sl:
      description: "Sets lobby spawnpoint"
      usage: "/sl <x> <y> <z>"
      permission: matrixpe.sl
    spec:
      description: "Sets spectator spawnpoint"
      usage: "/spec"
      permission: matrixpe.spec
    leave:
      description: "Leaves the match"
      usage: "/leave"
      permission: matrixpe.leave
    play:
      description: "Joins a match"
      usage: "/play"
      permission: matrixpe.play
    permissions:
    matrixpe:
      description: "Allows accsess to all MatrixPE features"
      default: op
      children:
       matrixpe.build:
        description: "Allows Building/Breaking"
        default: op
       matrixpe.command:
        description: "Allows accsess to all MatrixPE commands"
        default: op
        children:
         matrixpe.command.sw:
          description: "Shows the Info"
          default: true
         matrixpe.command.ss:
          description: "Set a Player spawn"
          default: op
         matrixpe.command.sl:
          description: "Sets the Lobby"
          default: op
         matrixpe.command.spec:
          description: "Sets the spectator spawn"
          default: op
         matrixpe.command.leave:
          description: "Leaves the match"
          default: true
         matrixpe.command.play:
          description: "Joins a match"
          default: true
    
    Lol the depend said SkyWars, changed to SkyWarsPE
    Now it just says:
    Code:
    15:49:30 [CRITICAL] Could not load plugin 'SkyWarsPE': Circular dependency detected
    
  4. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    depend: SkyWarsPE, that mean u must have this plugin in your server
    Andrey Nazarchuk likes this.
  5. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    So what should I put there to make it work?
  6. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    delete depend: SkyWarsPE

    name: SkyWarsPE
    version: COREv1.0.0
    api: 1.12.0
    main: SkyWarsPE\Main
    author: Hidden
    description: SkyWarsPE, Custom SkyWars plugin
    website: Hidden
    depend: SkyWarsPE <---
    commands:
  7. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Remove what? the depend: SkyWarsPE?
  8. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Thanks!
  9. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    Sorry for my bad English, I mean remove "depend: SkyWarsPE" in plugin.yml (Line 8)
    Andrey Nazarchuk likes this.
  10. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Alright, thank you very much!:D:D:D
    xiaoq likes this.
  11. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Should I use:
    use pocketmine\plugin\Listener;
    or
    (this is line 48) use pocketmine\event\Listener;

    Because the plugin crashed and said I can only use one listener:
    Code:
    Fatal error: Cannot use pocketmine\event\Listener as Listener because the name is already in use in C:\Users\Andrey\Downloads\PocketMine-MP\plugins\SkyWarsPE\src\SkyWarsPE\Main.php on line 48
    
  12. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    For me, I will use pocketmine\event\Listener;:) Because I never saw pocketmine\plugin\Listener; yet
    Andrey Nazarchuk likes this.
  13. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Ok, fixed a few crashes, now this :(:(:(

    Attached Files:

  14. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    try this:
    Replace
    PHP:
    $this->getDefaultConfig(); 
    PHP:
    $this->saveDefaultConfig();
  15. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    The thing is, its at the start of the file so the config needs to be loaded, not saved.
  16. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    eh...
    PHP:
    $this->saveDefaultConfig(); // saves config.yml if it doesn't already exist
    $this->reloadConfig(); // pre-load the config so that the file is loaded in startup time rather than runtime, improving server performance
    $this->getServer()->getPluginManager()->registerEvents($this$this);
    code from github:https://github.com/PEMapModder/Pock...e/ChatBlocker/src/chatblocker/ChatBlocker.php
    Andrey Nazarchuk likes this.
  17. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Thanks!
  18. shoghicp
    Offline

    shoghicp Staff Member PocketMine Team

    Joined:
    Aug 22, 2013
    Posts:
    433
    Plugins:
    14
    Minecraft User:
    shoghicp
    Please read the API. saveDefaultConfig() will save the default values to the file. When you call getConfig() at any time it's loaded, you do t have to do anything else
    LDX, Andrey Nazarchuk and Falk like this.
  19. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The use statements are not dependencies.
    Circular means it depends on a plugin that depends on it too. So PocketMine is confused which to load first, and rages and throws both plugins off the street. In this case, the plugin asked to be loaded before itself and after itself and frustrated PocketMine.
    Falk, LDX and Andrey Nazarchuk like this.
  20. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    ok, thanks!

Share This Page

Advertisement