Printing to a text file

Discussion in 'Plugin Development' started by Pink__Slime, Apr 9, 2013.

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

    Pink__Slime

    Ok I am new when it comes to external files and being honest here, I have no idea how to use them and all.
    So I'm wondering how to print text given in a command to a text file in the plugins folders.

    Example:
    Admin and player are on the server. Player is spamming. Admin uses command, /warn player spamming. A new line in the text document shows, "Player was warned by Admin for spamming."

    Also, how would I retreive all entries with on command?
     
  2. Offline

    gomeow

    I would suggest using YAML for this, then you could just use the config api
     
  3. Offline

    Pink__Slime

    gomeow As I said I've never done this type of stuff so could you please give me an example of how to retrieve and send?
    Much obliged :)
     
  4. Offline

    SnipsRevival

    I would print whatever you want to a yaml file.
    1. Create a yml file to store your strings
    2. Create an arraylist that gets the list of strings from the yml file (don't worry that it is empty right now)
    3. Add the string from your command to the arraylist
    4. Take your yml file and set the path where you want your list of strings as your arraylist
    5. save the yml file
     
  5. Offline

    Devil0s

Thread Status:
Not open for further replies.

Share This Page