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

Remember to declare namespaces!

Comments in 'Resources' started by GlaciercreepsMC, Oct 22, 2014.

  1. GlaciercreepsMC
    Offline

    GlaciercreepsMC Active Member Plugin Developer

    Joined:
    Jan 21, 2014
    Posts:
    91
    Plugins:
    1
    Minecraft User:
    GlaciercreepsMC
    Ok, I spent about 30 min to an hour trying to figure out a problem with a test plugin. This is the second time this has happened to me, and is very frustrating.

    Declare your namespace.
    Screen Shot 2014-10-22 at 4.36.13 PM.png
    If you see something like that above, you have done 1 of 3 things:
    1. Forgotten to declare namespace. DevTools will not be able to find your main class if you don't, and this is very frustrating. A namespace, for the new people, is basically a way of organizing code, usually in separate folders. Example:
      Code:
      namespace author\exampleplugin;
    2. You forgot to type the path of your main class in plugin.yml . If you're following the setup like here, be sure to omit the 'src' part of your path, and also omit the '.php' at the end of it. Example, instead of this:
      Code:
      #plugin.yml
      main: src\author\exampleplugin\MainClass.php
      Use this:
      Code:
      #plugin.yml
      main: author\exampleplugin\MainClass
    3. You typed the wrong path. Look carefully at what you typed, and fix it.
    I know this was a short thread, but I don't want anyone else (especially new people) to have to stress out for an hour figuring this out. :cool:
    Last edited: Oct 23, 2014
    PEMapModder likes this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Normally, we either use lowercase for the whole namespace or camelcase, not partly :p

    Also, you should add that you forgot to put the main class inside the "main" property ;)
    GlaciercreepsMC likes this.
  3. GlaciercreepsMC
    Offline

    GlaciercreepsMC Active Member Plugin Developer

    Joined:
    Jan 21, 2014
    Posts:
    91
    Plugins:
    1
    Minecraft User:
    GlaciercreepsMC
    Oh pfft, what a fail. And, hehe, I hadn't realized about the namespace case, since the Pocketmine plugin setup shows Pascal case. But I see what you mean. I fixed them now.
    PEMapModder likes this.

Share This Page

Advertisement