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

Controll Practice

Comments in 'Plugin Development' started by Marcelo234, Mar 11, 2016.

  1. Marcelo234
    Offline

    Marcelo234 New Member

    Joined:
    Oct 18, 2014
    Posts:
    204
    Hey Guys..I want to test some things! So there is a Folder and in this folder a few files are! The files name can't be anything! IMPORTANT: The Files name will change their name every few minutes! Some Files could be remove or create with a new random name!! So In every File there is a Random thing....(All the files are in "Random/")
    For Example(here 3 files!):
    File1:
    Code:
    Random: "a"
    File2:
    Code:
    Random: "z"
    File3:
    Code:
    Random: "e"
    So now the Plugin should get all Files at same time...He should cgeck...For Example: If the Random: ""
    == e a Event will happen....
    My ask is: => How I get all the Random Files?
    PHP:
    $files = new config($this->getDataFolder() . "Random/"Config::YAML, array());
    And than check?
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Foreach the files.
  3. Marcelo234
    Offline

    Marcelo234 New Member

    Joined:
    Oct 18, 2014
    Posts:
    204
    Soorrrrryy,don't understand correctly..
  4. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Do you know foreach? If not, google it.
    Simply foreach the files in your directory:
    PHP:
    $files scandir($this->getDataFolder()."Random/");
    foreach(
    $files as $file) {
      
    // Do something
    }
  5. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Use glob() with the asterisk or the RecursiveDirectoryIterator, though better use glob.
    PEMapModder likes this.

Share This Page

Advertisement