Problems with public String

Discussion in 'Plugin Development' started by zDaniel2308, Jan 4, 2021.

  1. Offline

    zDaniel2308

    Hello, I have a problem, when I do a public String and put a for, it asks for a return, I am doing a cooldown inside that for, what I do is that that for goes through the recompensas.yml file, but when it comes to seeing the cooldown just show cooldown
    of an element, and not of all the ones in the file, I also had a similar problem before when opening an inventory, it was due to the return, and I think that this time the problem is the same, only that before it was not optional to put the return, on the other hand now yes, if I remove the for it is not necessary but if the for is, yes or if a return should go if not, throw error (sorry for my bad English)
    This is my code: https://pastebin.com/PjXyaLsn
     
  2. Online

    CraftCreeper6

    @zDaniel2308
    Tough to understand.

    You don't need to use a for loop in this case because you already know the path and you only want that specific players cooldown, not everyone's. Remove the for loop and use config#get() instead.
     
  3. Offline

    zDaniel2308

    Yes, an apology for that, I'm making a rewards plugin, in the recompensas.yml file is a list of rewards for different ranks, I want each reward to have a cooldown, the only way I can think of for the plugin to detect everything what I put in the recompensas file is putting a for, since the for goes through the file and repeats that loop
     
  4. Online

    CraftCreeper6

    @zDaniel2308
    What do you store in the config? Is it just the cooldown or is it System.currentTimeMillis + cooldown?
     
  5. Offline

    zDaniel2308

    It is the server time, what it does is see the time the reward was claimed and compare it with the time the player is trying to claim
     
  6. Online

    CraftCreeper6

    @zDaniel2308
    I know what you're trying to do that wasn't my question.

    What value do you store in the config?
     
  7. Offline

    zDaniel2308

    The time the reward was claimed, that stores, only it is set in the inventory class
     

Share This Page