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

[HELP] Learning plugin development!

Comments in 'Plugin Development' started by Primus, Apr 7, 2015.

  1. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    Hi, so i'm learning plugin programming for a week. So i decided to request help from forum :).
    I hope you'll help me.

    I want to make my first plugin like this:

    description: Teleports all players to you on a single commands and on command return them back.

    How is it possible? like /call <player name | all> and /return <player name | all>?

    ;)
  2. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    First of all you must register commands in plugin.yml
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    First of all thanks for replay :), Second sorry for my english if i type something non-logic tell and Third i want to make a source code of the plugin with feutures(srry, spelling :D) showed above! So yea is the source code the .php file showed in main?
  4. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    435
    Plugins:
    4
    Minecraft User:
    Lambo
    What if your plugin doesn't use any commands?
    PEMapModder likes this.
  5. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    Then do nothing :D just register the plugin info in plugin.yml(am i right?)
    wait you're "plugin developer" you should know it!
    hoyinm14mc likes this.
  6. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    He specified he wants to add commands
  7. hoyinm14mc
    Offline

    hoyinm14mc Notable Member Plugin Developer

    Joined:
    Jun 4, 2014
    Posts:
    502
    Plugins:
    9
    Minecraft User:
    hoyinm14mc
    Maybe when op used call command, a pocketmine\utils\Config file will be generated and saved all player's location before they teleport, then teleport.
    When you use return command, all players return, and the Config file will be deleted.
    return command is not usable while no Config file was found.
  8. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    What code should it run to get config file and get all positions?

    and how to make it save like this?

    Player = $x $y $z
  9. hoyinm14mc
    Offline

    hoyinm14mc Notable Member Plugin Developer

    Joined:
    Jun 4, 2014
    Posts:
    502
    Plugins:
    9
    Minecraft User:
    hoyinm14mc
    PHP:
    //create a config file
    //Put it in onEnable()
    $this->cfg = new Config($this->getDataFolder()."data.yml"Config::YAML, array());
    For how to save locations, look at EvolSoft's MSpawns. It's easy
  10. Gamecrafter
    Offline

    Gamecrafter Notable Member Plugin Developer

    Joined:
    Nov 20, 2014
    Posts:
    981
    Plugins:
    9
    Mind that isn't the only way to save information.
    PEMapModder likes this.
  11. hoyinm14mc
    Offline

    hoyinm14mc Notable Member Plugin Developer

    Joined:
    Jun 4, 2014
    Posts:
    502
    Plugins:
    9
    Minecraft User:
    hoyinm14mc
    I'm just telling a simple way to save information. Is there any problem? If you have any complains, I don't mind you report my post.
    If you have more ways to save informations, just comment in this thread.
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Config file is a poor way of saving information. You should just save it in memory. You don't need to use a Config class.
  13. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    Ok i'll try to put something of this together at the evening after school it's now for me 8:27 pm
  14. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,472
    Minecraft User:
    PrimusLV
    How can i save each player? foreach()?

Share This Page

Advertisement