mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Add new DatabaseAPI
This commit is contained in:
parent
0b0408ef98
commit
7679afd3e0
@ -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
|
||||||
|
33
src/main/java/com/gmail/nossr50/api/DatabaseAPI.java
Normal file
33
src/main/java/com/gmail/nossr50/api/DatabaseAPI.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user