Checking property settings

Discussion in 'Plugin Development' started by nossr50, Feb 26, 2011.

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

    nossr50

    Is there a way to check the property settings of server.properties from within bukkit?
     
  2. Offline

    Edward Hand

    There are many ways. Here's one:

    Code:
    FileReader fr = new FileReader("server.properties");
    BufferedReader br = new BufferedReader(fr);
    String property;
    String s;
    while((s=br.readLine()) .indexOf(propertyName)==-1);
    property = s.split("=")[1];
    fr.close();


    Replace propertyName with the name of the property you're after and the value (as a string) will be stored in 'property'

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

    nossr50

    You're incredibly helpful, thanks.
     
Thread Status:
Not open for further replies.

Share This Page