mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2025-02-18 05:11:22 +01:00
Fixes #222
This commit is contained in:
parent
445e5a03e2
commit
15655b821d
@ -1084,7 +1084,20 @@ public class ChallengesManager
|
|||||||
private void resetAllChallenges(@NonNull String storageDataID, @NonNull String gameMode)
|
private void resetAllChallenges(@NonNull String storageDataID, @NonNull String gameMode)
|
||||||
{
|
{
|
||||||
this.addPlayerData(storageDataID);
|
this.addPlayerData(storageDataID);
|
||||||
this.playerCacheData.get(storageDataID).reset(gameMode);
|
|
||||||
|
if (this.playerCacheData.containsKey(storageDataID))
|
||||||
|
{
|
||||||
|
// There may be a rare situation when player data cannot be loaded. Just avoid
|
||||||
|
// error.
|
||||||
|
this.playerCacheData.get(storageDataID).reset(gameMode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If object cannot be loaded remove it completely.
|
||||||
|
this.playersDatabase.deleteID(storageDataID);
|
||||||
|
this.addon.logError("Database object was not loaded. It is removed completely. Object Id: " + storageDataID);
|
||||||
|
}
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
this.savePlayerData(storageDataID);
|
this.savePlayerData(storageDataID);
|
||||||
}
|
}
|
||||||
@ -1399,7 +1412,7 @@ public class ChallengesManager
|
|||||||
* @param world - World where challenges must be reset.
|
* @param world - World where challenges must be reset.
|
||||||
* @param adminID - admin iD
|
* @param adminID - admin iD
|
||||||
*/
|
*/
|
||||||
public void resetAllChallenges(UUID userID, World world, UUID adminID)
|
public void resetAllChallenges(@NonNull UUID userID, World world, @Nullable UUID adminID)
|
||||||
{
|
{
|
||||||
String storageID = this.getDataUniqueID(userID, Util.getWorld(world));
|
String storageID = this.getDataUniqueID(userID, Util.getWorld(world));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user