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

Implement task in the main file?

Comments in 'Plugin Development' started by MyNameIsTriXz, Feb 3, 2016.

  1. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Is it possible to implement the task in the main file (under main class)?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No in PHP 5.6
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Inside main file? Yes
    PHP:
    // Main.php
    namespace some\name\space;

    class 
    Main extends PluginBase {}
    class 
    Timer extends PluginTask {}
    MyNameIsTriXz likes this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No. If you put a class not in a file with its name, strange things may happen. You can do it right without crashing, but any plugins that do this will not be approved on the forums, and in the future may not work.
    applqpak and Primus like this.
  5. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    I know the side effects. I just answered question thats written on threads title.
  6. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    And lets put this together: How to implement task in the main file, under main class?
    PHP:
    // Main file
    class Main extends PluginBase {}
    /*
    * Under the Main class
    */
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    you know, it is quite irresponsible just to answer the question without pointing out its problems, since future readers may think that this will become a solution.
    applqpak likes this.
  8. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    Vaivez66 likes this.
  9. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    Technically it isn't even in the main class, your just initiating another class within the main file.
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    CrazedMiner and jojoe77777 like this.

Share This Page

Advertisement