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

Help plugin

Comments in 'Plugin Development' started by yuri, Sep 29, 2015.

  1. yuri
    Offline

    yuri New Member

    Joined:
    May 20, 2015
    Posts:
    35
    Minecraft User:
    yodaylay22
    I'm starting to understand a little about how to create plugins and wonder how I use these things like: use pocketmine \ block \ Lava;
    use pocketmine \ block \ Water;
    use pocketmine \ event \ block \ BlockUpdateEvent;
    use pocketmine \ event \ entity \ EntityExplodeEvent;
    use pocketmine \ event \ Listener;
    use pocketmine \ event \ level \ LevelLoadEvent;
    use pocketmine \ event \ level \ LevelUnloadEvent;
    use pocketmine \ utils \ Config;
    use pocketmine \ event \ block \ BlockPlaceEvent;
    use pocketmine \ event \ block \ BlockBreakEvent;
    use pocketmine \ event \ player \ PlayerInteractEvent;
  2. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    Tip:

    Learn PHP, see the plugins and forums...
  3. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    CrazedMiner likes this.
  5. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    PHP:
     use 
    is a PHP function, it's like
    PHP:
     require() 
    but is for OPP PHP. It basically tells the server that the plugin is going to be using those classes.

    If you're staring at your screen confused about what I'm saying, I'd suggest you try and learn more about PHP and the PocketMine API.
  6. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    Actually use is quite different from require. use simply imports a class to your current namespace. PocketMine (or actually SPL, Standard PocketMine Library) implements a class loader that will use include (which is very similar to require) to load the class. In fact, allthough it is bad form, you can dispense the use altogether and refer to the class directly (either because it is in the same namespace or because you use the full class path).
    PEMapModder and CrazedMiner like this.
  7. PolskiTHEPLAYER
    Offline

    PolskiTHEPLAYER New Member

    Joined:
    Apr 1, 2015
    Posts:
    55
    Minecraft User:
    Flsmers
    What name is your plugins?
  8. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Don't say that, you should take what you said and say it to yourself. Anyways it's great to see someone actually understand(a little) how PocketMine works.
    zombie_Power likes this.
  9. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    I wasn't saying that they were equivalent, I was simply stating that they are in a way the same.
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    They are different entirely. use is like a preprocessor statement like #define in C. use just replaces all mentions of a certain class name in your script into the full class name, but require() loads a PHP file. You can use a class without using a use statements (by using a fully qualified class name), and you still need to require/include a file even with OOP.

Share This Page

Advertisement