Saving home coordinates and loading them?

Discussion in 'Plugin Development' started by rockyandirou, Mar 25, 2012.

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


    I got it to work but is there a possibility that it don't save it in the config file but that it saves in a file lik home.txt
    hopefully you can help me
  2. Offline


    you can make your own yml file whit the classes inside bukkit
  3. Offline


    How can i do that

    how can i load a other file then config i mean in onEnable i need to load them right?
  4. Offline


    to load a seperate file into a FileConfiguration object, you do FileConfiguration yourConfig = YamlConfiguration.loadConfiguration(file)//static method
  5. Offline


    and how can i get that file in a executor or listener
  6. Offline


    you create it. basically do this

    File file = new File(yourPlugin.getDataFolder()+File.seperator+directoryOfYourConfig+File.seperator+configName+".yml");
    File folder = new File(yourPlugin.getDataFolder()+File.seperator+directoryOfYourConfig);
    Okay, to explain what this does, you first create two files. one is your file location (variable "file") and another is the files directory. (im sure theres a better way to do this other than two file objects, but just bear with me, i havnt looked into it yet) first, you check if the directory exists (first if statement) if not, create the directories (mkdirs()) then, check if the file exists, if not, create it (createNewFile()) then you save the config TO that file (

    easy :3
  7. Offline


    and to get it in a listener
    it's just make a variable?
    And it doen't work i get an error in eclipse
  8. Offline


    its because thats not code, its psuedocode.

    you use this in your listener, as a function. you dont pass it into your listener as a variable.
Thread Status:
Not open for further replies.

Share This Page