Skip to content

Commit

Permalink
Add another error message if mcMMO finds something unexpected in the …
Browse files Browse the repository at this point in the history
…database
  • Loading branch information
nossr50 committed Mar 11, 2021
1 parent e95b7f7 commit 72116d8
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,15 @@ public boolean saveUser(PlayerProfile profile) {
boolean wroteUser = false;
// While not at the end of the file
while ((line = in.readLine()) != null) {
boolean goodData = true;

//Check for incomplete or corrupted data
if(!line.contains(":"))
if(!line.contains(":")) {
mcMMO.p.getLogger().severe("mcMMO found some unexpected data in mcmmo.users and is removing it");
continue;
}

String[] splitData = line.split(":");

//This would be rare, but check the splitData for having enough entries to contain a username

if(splitData.length < USERNAME_INDEX) { //UUID have been in mcMMO DB for a very long time so any user without
//Something is wrong if we don't have enough split data to have an entry for a username
mcMMO.p.getLogger().severe("mcMMO found some corrupted data in mcmmo.users and is removing it.");
Expand Down

0 comments on commit 72116d8

Please sign in to comment.