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

Can anyone help me with my plugin?

Comments in 'Plugin Development' started by CoolGuyPL, Sep 25, 2014.

  1. CoolGuyPL
    Offline

    CoolGuyPL New Member

    Joined:
    Sep 24, 2014
    Posts:
    43
    Minecraft User:
    CoolGuyPlays
    well im new to php and i already made a coordinates plugin and published it and its currently waiting approval. im working on a new plugin called "SpecialMessages" which gives special messages when a user mentioned in the config joins the game.
    The problem is i want pocketmine to acess the config file and use the player name but im failing in trying.
    for the message im gonna use setJoinMessage. i want to link up the plugin and config file to use the players name. can you please help me with this? here is the code

    Attached Files:

  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    aFolder()."config.yml"Config::YAML, array(
                        
    "player"=> array (
                            
    "player1",
                            
    "player2",
                            
    "player3",
                            
    "player4",
                            
    "player5",
                            
    "player6",
                            
    "player7",
                            
    "player8",
                            
    "player9",
                            
    "player10",
                           
                        )
    Wtf are you doing?
    EvolSoft and LDX like this.
  3. Dalton
    Offline

    Dalton Banned

    Joined:
    Jul 7, 2014
    Posts:
    38
    Minecraft User:
    DALTONTASTIC
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    He limited it to 10 players?
  5. CoolGuyPL
    Offline

    CoolGuyPL New Member

    Joined:
    Sep 24, 2014
    Posts:
    43
    Minecraft User:
    CoolGuyPlays
    dude im new to php...
  6. Dalton
    Offline

    Dalton Banned

    Joined:
    Jul 7, 2014
    Posts:
    38
    Minecraft User:
    DALTONTASTIC
    @CoolGuyPL I suck at coding too that's why I have others do it for me. But for the sake of this post I'd be more descriptive with what functionality you want the plugin to have. It's very vague and leaves me super confused. Your plugin will get there! It takes time :)
  7. WillotheBlessed
    Offline

    WillotheBlessed Active Member

    Joined:
    Sep 17, 2014
    Posts:
    69
    Minecraft User:
    will
    There's some nice API for saving and loading config files. I'm just learning to use them now, but this might help you. Use this code from our plugin base.
    Code:
    $this->getConfig()->getAll(); //gets your config as an array
    $this->getConfig()->setAll($yourArray); //sets your config in array form
    $this->getConfig()->save(); //puts your config from array form back to saved yml form.
    
    I'd suggest looking at a simple plugin such as "TimeCommander by LDX" which uses a config file, and build from there with these API to get the kind of config functionality you need.
    EvolSoft, LDX and CoolGuyPL like this.
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I just said, saving data should be in a separate file, not the same config file.
    Last edited: Sep 25, 2014
    CoolGuyPL likes this.
  9. CoolGuyPL
    Offline

    CoolGuyPL New Member

    Joined:
    Sep 24, 2014
    Posts:
    43
    Minecraft User:
    CoolGuyPlays
    thank you dude:)
  10. GlaciercreepsMC
    Offline

    GlaciercreepsMC Active Member Plugin Developer

    Joined:
    Jan 21, 2014
    Posts:
    91
    Plugins:
    1
    Minecraft User:
    GlaciercreepsMC
    lol, coming from bukkit, since most of the pocketmine source is similar to it, I thought it hadn't had support for configs yet (bukkit's config sources are in its own "config" folder, not utils). :oops:
    I guess i never bothered looking through there, so this thread helped me with one thing...
  11. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    I recommend you to learn other things first, configs are a bit hard to use, even for me and my team (@LegendsOfMCPE ) or not @PEMapModder?
    CoolGuyPL likes this.

Share This Page

Advertisement