Solved Better way of setting file max?

Discussion in 'Spigot Plugin Development' started by Polarcraft, Jun 30, 2016.

Thread Status:
Not open for further replies.
  1. So I currently am trying to limit the amount of sections in my custom .yml file. I have this method that I guess works, but I want to know if there is a better way of doing this. Also 'long i' is the file size with the amount of section data.

    Current code (f = File):
    Code (Text):
    long i = 499265826816L;
    if(f.getTotalSpace() <= i) {
        sender.sendMessage("Error: can't add more warps!");
    } else if(!(f.getTotalSpace() <= i)) {
    //code here
  2. Couldn't you always use getKeys(false).size(); and check if it is equal to your specified max amount. Not sure if it's the best way though.
  3. Doesn't really work that well, actually doesn't work at all for what I am wanting to do.

    [Edit] and now my code doesn't work :(
  4. How doesn't that work?
  5. I guess how I was doing it, but It did work once I threw it into a Set.
Thread Status:
Not open for further replies.