Creating its own folder/config

Discussion in 'Plugin Development' started by bmcc1234, Jan 26, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    bmcc1234

    ok i have a plugin and i have been sent to sites to try to get the code to get my plugin to generate its own Folder with a txt in the folder and can someone help me with this i am done this is all i need
     
  2. Offline

    william9518

    If !txtfile.exists {
    Txtfile.mkdirs();
    }
     
  3. Offline

    Adamki11s

    bmcc1234
    You could use google...

    Code:java
    1.  
    2. File f = new File("path relative to root directory of your mc server");
    3. if(!f.exists()){
    4. //do stuff
    5. }
    6.  
     
  4. Offline

    bmcc1234

    ok do i put this before the public class [Classname] extends JavaPlugin
     
  5. Offline

    Adamki11s

    bmcc1234
    Sorry but if you need to ask that I'd say you really need to have at least a basic understanding of Java before you start coding plugins. I'd suggest you check out the Plugin Tutorial on the wiki there are plenty of links up on there to learning resources. I'd suggest the new boston's java tutorials, they help me out.
     
  6. Offline

    bmcc1234

    um my plugin is finished

    i just dont know how to do this

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  7. Offline

    Adamki11s

    bmcc1234
    Like I said I really don't understand how you can be asking this.

    But nevertheless, it needs to go inside your class declaration, and the f.exists() part needs to inside of your on enable.

    So...
    Code:java
    1.  
    2. class{
    3. File f;
    4.  
    5. public void onEnable(){
    6. //fexists
    7. }
    8. }
     
  8. Offline

    william9518

    This... Where to put this... Omg... Facepalm. Learn basic java object oriented programming before trying to make a plugin, especially one with files.

    We dont care if its finished, making plugins isnt about copying from other people or from the forums. This is for asking so you can do it by urself later. Read my otther post for more info...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  9. Offline

    bmcc1234

    actually i made this one myself
     
  10. Offline

    william9518

    So why ask us?
    Gaah forget it just put the checks in another method like void checkfile and invoke it in ur onenable
     
Thread Status:
Not open for further replies.

Share This Page