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

What I THINK is the Basics of a PocketMine Plugin

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

  1. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    Before I write this post this is what I UNDERSTAND is the basics of creating PocketMine plugins. I will probably get killed at that this is not right but anyways.

    Let's Get Started. This can be used as a tutorial for beginners.

    For making PM Plugins you will need to know PHP. You can learn this from places such as CodeCademy or PHP.Net.

    First things first you need to find an Editor for your plugin. I normally use Notepad. But if you want something fancy you could try NetBeans or I believe Eclipse works too.

    Open your editor and write the following:

    Code:
    name: PluginName
    author: YourName
    api: [1.8.0]
    version: 1.0
    main: YourName\PluginName\Main
    
    Then save it in a document called 'plugin.yml'.
    The next thing you need to do is create a set-up/infrastructure for your plugin. Create a new folder called 'src'. Inside that create one with your Name then a folder inside that of your Plugin Name and go back to your text editor.

    The following is the code of the 'core' of your plugin.

    PHP:
    <?php

    namespace YourName\PluginName;

    use 
    pocketmine\plugin\PluginBase;

    class 
    Main extends PluginBase {
    public function 
    onEnable(){
    $this->getLogger()->info("onEnable() has been called!");
    }
    public function 
    onDisable(){
    $this->getLogger()->info("onDisable() has been called!");
    }
    }
    And now if you save the file as 'Main.php' and make it to a phar with @PEMapModder's Converter at pemapmodder.zapto.org/pm/ and load it on your server it should load and there you have made your very first PocketMine plugin. Well Done!

    I will leave a download here for you: http://bit.ly/1H1xGj6

    If you have any comments on how I make my plugins or anything then please leave it in the comments of this post.
  2. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    1. You don't need PEMapModder's plugin maker, considering that many developers use DevTools (much easier).
    2. API - I use - is 1.0.0, not [1.8.0]
    3. onEnable() and onDisable() aren't necessary, but they definitely can be used.
    4. You don't need to make it 'main.php'
    5. Nothing else.
    6. https://github.com/PocketMine/Documentation/wiki/Plugin-Tutorial

    This guide is definitely good, just needs to have more details through the instructions.
  3. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    I know. I have trouble with DevTools.
    I sometimes use that API.
    Sometimes don't include the EnAbles and DisAbles
    I know I could call it something else and I a followed that guide but I hope I made it simpler with this tutorial.
    HotFireyDeath likes this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    1. My website will be moved to http://I.MCPE.me/pm soon. Also there are some features that my website has but DevTools doesn't.
    2. That depends on what API functions you use. For good practice, always make the API at the level you test your plugin at.
    4. Then what is it?
    5. Wat
    6. That's pretty inadequate.
  5. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    1. Soon. For now, it's better to use DevTools, since that was what it was designed for.
    2. Yeah...
    4. You can name it your plugin name as well. Say I have a plugin called "TimeZones". You can name it TimeZones.php
    5. LOL
    6. Yes, I do agree that it doesn't explain much about the plugin as a whole, but neither is this guide. It is also inadequate :p
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    1. My website has namespace optimization and obfuscate. Does DevTools have that?
    4. Oh I see. Same.
    6. I want to make one but don't have time :(
    HotFireyDeath likes this.
  7. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    @PEMapModder When you change your website address I will update it on this post IF I remember.
    PEMapModder likes this.

Share This Page

Advertisement