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

API set?

Discussion in 'Development' started by MCPuppy, May 2, 2017.

  1. MCPuppy

    MCPuppy Creeper

    Messages:
    4
    GitHub:
    MCPuppy
    Hello, I am new here and I have a question. Can you set the API of the server in a plugin if you can how? Sorry I'm just started learning PHP :p
     
  2. McpeBooster

    McpeBooster Baby Zombie

    Messages:
    190
    GitHub:
    mcpebooster
    you can set the Api Verson on the plugin.yml:
    Code:
    api: 3.0.0-ALPHA5
     
  3. MCPuppy

    MCPuppy Creeper

    Messages:
    4
    GitHub:
    MCPuppy
    Sorry for any miscommunication. I meant API of the server.
     
  4. McpeBooster

    McpeBooster Baby Zombie

    Messages:
    190
    GitHub:
    mcpebooster
    you can edit the source, but this is not recommendable, not even as a beginner
     
  5. MCPuppy

    MCPuppy Creeper

    Messages:
    4
    GitHub:
    MCPuppy
    I know. Sorry for any miscommunication. I meant API of the server, through a plugin. Sorry if I wasn't clear enough.
     
  6. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Currently no, there is no way other than modifying source as mentioned above. I doubt there will be a way, because the API is bumped for the good reason that there's a lot of backwards incompatible changes.
     
  7. MCPuppy

    MCPuppy Creeper

    Messages:
    4
    GitHub:
    MCPuppy
    Oh. :( All my plugins are API 2.0.0 even though they work fine. And I can't change every single one.
     
  8. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    there are various tools on different websites to bump the API versions of plugins. Here is one that I believe works: DevTools/pocketmine.php
    I recommend using the API3 injector. Be warned that changing the API without ensuring that the plugin is compatible may cause unforeseen consequences
     
  9. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    yes you may but it would require good knowledge of PHP
    note for the wizards
    You would need phar extension that's capable of writing OR PM in uncompiled source
    you would need to locate "PocketMine.php" targeting this line, https://github.com/pmmp/PocketMine-...30ee507c7e4/src/pocketmine/PocketMine.php#L77
    your best bet would be to foreach the whole file in lines and regex match the const name
    for "optimization" you could skip to line 77 to check if it's there only then use the foreach trick
    after obtaining the line to target overwrite it with whatever you want, like const "API_VERSION = "5.5.5";"
    you would need to save and reboot PMMP to let it take effect
    i doubt reflection class would do the trick
    ALSO note: do this on your own risk, this is just a theory
     
  10. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    No, do not do this. The author has not actually catered for changes in API 3.0.0 alphas, it's exactly the same as the 2.0 one except with different numbers.
     
    jasonwynn10 likes this.
  11. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    If the server API version doesn't need modification, it doesn't need bumping in the first place... (With the exception of anything from Microsoft)
     
    corytortoise and jasonwynn10 like this.
  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.