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

How would be the best way to program pocketmine plugins and which software is more unlaggy? Nukkit?

Discussion in 'General discussion' started by LewBr, Oct 22, 2017.

  1. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    Why do we use multiple files in each plugin, why not just use Main? If I put the code of an entire CORE in 1 main file the server gets less lagged? How would be the best way to program pocketmine plugins to get less lag?
     
  2. KnownUnown

    KnownUnown Spider Jockey Poggit Reviewer

    Messages:
    47
    GitHub:
    knownunown
    1. For simple plugins, it may be better to place all your code in one file. However, for larger plugins, splitting code up into different files and classes makes your code easier to read and understand.
    2. There is no simple way to go about optimizing slow running plugins. Some general suggestions would be to put slow operations into an AsyncTask or cutting down on world I/O.
     
    Thunder33345 likes this.
  3. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    It still AsyncTask working on PMMP? ALPHA10
     
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    They are not called "files". They are called "classes". Indeed, there is no reason (except for code organization) to make classes like EventListener; most people do it just because it "sounds cool" without understanding the true impacts [citation needed].
    There are also classes that make data structures, or files that declare interfaces and let other classes implement. This is related to object oriented programming, and there are many articles on the Internet if you want to know more.
    The number of files has almost no impact on performance. Mixing files will have no impact on the server's performance except probably a few milliseconds when the server starts (or even unnecessarily slower because of loading unused classes).
     
  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.