Add new DatabaseAPI

This commit is contained in:
nossr50 2019-06-06 23:15:18 -07:00
parent 0b0408ef98
commit 7679afd3e0
2 changed files with 34 additions and 1 deletions

View File

@ -1,5 +1,5 @@
Version 2.1.70 Version 2.1.70
Added new DatabaseAPI to the API package, has features relating to database operations
Version 2.1.69 Version 2.1.69
Fixed a few places where mcMMO would not save player data immediately which may cause players to lose a few minutes of progress Fixed a few places where mcMMO would not save player data immediately which may cause players to lose a few minutes of progress

View File

@ -0,0 +1,33 @@
package com.gmail.nossr50.api;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.mcMMO;
import java.util.UUID;
public class DatabaseAPI {
/**
* Checks if a player exists in the mcMMO Database
* @param uuid player UUID
* @return true if the player exists in the DB, false if they do not
*/
public boolean doesPlayerExistInDB(String uuid) {
return doesPlayerExistInDB(UUID.fromString(uuid));
}
/**
* Checks if a player exists in the mcMMO Database
* @param uuid player UUID
* @return true if the player exists in the DB, false if they do not
*/
public boolean doesPlayerExistInDB(UUID uuid) {
PlayerProfile playerProfile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid);
if(playerProfile.isLoaded())
return true;
else
return false;
}
}