[Help] config files

Discussion in 'Plugin Development' started by flamboo, Oct 19, 2014.

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

    flamboo

    I need help on how to get time value from a config file.

    Here is my code bellow,
    Code:
        new BukkitRunnable()
          {
            public void run() {
              h.delete();
            }
          }
          .runTaskLater(this, 1500L);
        }
    I want players to be able to change the time of the runnable event in the config file,

    I have already got the config file to create the integer just don't know how to get the value from it in a simple term
     
  2. Offline

    FerusGrim

    Code:java
    1. getConfig().getInt("path.to.int");
     
  3. Offline

    Gater12

    FerusGrim likes this.
  4. Offline

    flamboo

    Thank you both ( Gater12 and FerusGrim ) but I still don't understand how. I have implmented the
    Code:java
    1. get.Config().getInt("path.to.my.int);

    But it still dosent work
     
  5. Offline

    FerusGrim

    I said: getConfig()
    Not: get.Config()
     
  6. Offline

    flamboo

    FerusGrim I meant that sorry,

    Here is my current code now

    Code:java
    1. new BukkitRunnable()
    2. {
    3. public void run() {
    4. h.delete();
    5. }
    6. }
    7. .runTaskLater(this, getConfig().getInt("Auto-Remove-Time"));
     
  7. Offline

    FerusGrim

    Looks fine to me.
     
  8. Offline

    The Fancy Whale

    Except that takes a long input, not an integer AFAIK.
     
  9. Offline

    flamboo

    @TheFaceWhale how would I go about imputing the integer in a better way,
     
  10. Offline

    FerusGrim

  11. Offline

    The Fancy Whale

    FerusGrim Well if you put it in the config in seconds you might want to do something like
    Code:java
    1. long l = (long) getConfig().getInt("path") * 20;
     
  12. Offline

    FerusGrim

    Sure.
     
  13. Offline

    flamboo

    FerusGrim @The Fancy Whale

    so I still cant get it to work,

    here is my current new code
    Code:java
    1. new BukkitRunnable()
    2. {
    3. long l = (long) getConfig().getInt("Auto-Remove-Time") * 20;
    4. public void run() {
    5. h.delete();
    6. }
    7. }
    8. .runTaskLater(this, getConfig().getInt("Auto-Remove-Time"));
     
  14. Offline

    FerusGrim

    What does "can't get it to work", mean?

    Also, again, change getInt() to getLong().
     
  15. Offline

    flamboo

    FerusGrim it means I don't know what to do to get it to work as intended.
     
  16. Offline

    FerusGrim

    What isn't working as intended?
     
Thread Status:
Not open for further replies.

Share This Page