Solved Saving information?

Discussion in 'Plugin Development' started by Stephanech, Feb 27, 2017.

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


    So, my case is: I'm running a scheduleSyncRepeatingTask like a timer, so when the time's up, the scheduler will write some in a config.yml in base a Player's name and cancel itself, the problem is, if the player is disconnected, the scheduler can not find the player (just because it's disconnected) and a Null error will appear (I guess)

    So, is there a way to store the Player's name and let that specific scheduler choose that specific name and not other?
  2. Offline


    Yes. Instead of storing the player's instance, store the player's name as a String and reference that object.
  3. Offline


    Store the players in a HashSet or List, (if you only need the names) and then find them from there. On disconnect remove them from the hashmap.

    If you want to continue using your system (although I don't recommend writing to a config every so often with a scheduler when you dont need to) then you can check if the player is equal to null
Thread Status:
Not open for further replies.

Share This Page