mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
We need both UUID and username to create new.
This commit is contained in:
parent
fc393e1047
commit
e6a7c8f5d2
@ -930,7 +930,7 @@ public final class ExperienceAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static PlayerProfile getOfflineProfile(UUID uuid) {
|
private static PlayerProfile getOfflineProfile(UUID uuid) {
|
||||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid, false);
|
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid);
|
||||||
|
|
||||||
if (!profile.isLoaded()) {
|
if (!profile.isLoaded()) {
|
||||||
throw new InvalidPlayerException();
|
throw new InvalidPlayerException();
|
||||||
@ -942,7 +942,7 @@ public final class ExperienceAPI {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
private static PlayerProfile getOfflineProfile(String playerName) {
|
private static PlayerProfile getOfflineProfile(String playerName) {
|
||||||
UUID uuid = mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId();
|
UUID uuid = mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId();
|
||||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid, false);
|
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid);
|
||||||
|
|
||||||
if (!profile.isLoaded()) {
|
if (!profile.isLoaded()) {
|
||||||
throw new InvalidPlayerException();
|
throw new InvalidPlayerException();
|
||||||
|
@ -56,7 +56,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
|||||||
UserManager.clearAll();
|
UserManager.clearAll();
|
||||||
|
|
||||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||||
PlayerProfile profile = oldDatabase.loadPlayerProfile(player.getUniqueId(), false);
|
PlayerProfile profile = oldDatabase.loadPlayerProfile(player.getUniqueId());
|
||||||
|
|
||||||
if (profile.isLoaded()) {
|
if (profile.isLoaded()) {
|
||||||
mcMMO.getDatabaseManager().saveUser(profile);
|
mcMMO.getDatabaseManager().saveUser(profile);
|
||||||
|
@ -73,7 +73,7 @@ public interface DatabaseManager {
|
|||||||
/**
|
/**
|
||||||
* Load a player from the database.
|
* Load a player from the database.
|
||||||
*
|
*
|
||||||
* @deprecated replaced by {@link #loadPlayerProfile(UUID uuid, boolean createNew)}
|
* @deprecated replaced by {@link #loadPlayerProfile(String playerName, UUID uuid, boolean createNew)}
|
||||||
*
|
*
|
||||||
* @param playerName The name of the player to load from the database
|
* @param playerName The name of the player to load from the database
|
||||||
* @param createNew Whether to create a new record if the player is not
|
* @param createNew Whether to create a new record if the player is not
|
||||||
@ -88,12 +88,9 @@ public interface DatabaseManager {
|
|||||||
* Load a player from the database.
|
* Load a player from the database.
|
||||||
*
|
*
|
||||||
* @param uuid The uuid of the player to load from the database
|
* @param uuid The uuid of the player to load from the database
|
||||||
* @param createNew Whether to create a new record if the player is not
|
|
||||||
* found
|
|
||||||
* @return The player's data, or an unloaded PlayerProfile if not found
|
* @return The player's data, or an unloaded PlayerProfile if not found
|
||||||
* and createNew is false
|
|
||||||
*/
|
*/
|
||||||
public PlayerProfile loadPlayerProfile(UUID uuid, boolean createNew);
|
public PlayerProfile loadPlayerProfile(UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a player from the database. Attempt to use uuid, fall back on playername
|
* Load a player from the database. Attempt to use uuid, fall back on playername
|
||||||
|
@ -388,11 +388,11 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public PlayerProfile loadPlayerProfile(String playerName, boolean create) {
|
public PlayerProfile loadPlayerProfile(String playerName, boolean create) {
|
||||||
return loadPlayerProfile(playerName, "", create);
|
return loadPlayerProfile(playerName, "", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerProfile loadPlayerProfile(UUID uuid, boolean create) {
|
public PlayerProfile loadPlayerProfile(UUID uuid) {
|
||||||
return loadPlayerProfile("", uuid.toString(), create);
|
return loadPlayerProfile("", uuid.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerProfile loadPlayerProfile(String playerName, UUID uuid, boolean create) {
|
public PlayerProfile loadPlayerProfile(String playerName, UUID uuid, boolean create) {
|
||||||
|
@ -688,11 +688,11 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public PlayerProfile loadPlayerProfile(String playerName, boolean create) {
|
public PlayerProfile loadPlayerProfile(String playerName, boolean create) {
|
||||||
return loadPlayerProfile(playerName, "", create, true);
|
return loadPlayerProfile(playerName, "", false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerProfile loadPlayerProfile(UUID uuid, boolean create) {
|
public PlayerProfile loadPlayerProfile(UUID uuid) {
|
||||||
return loadPlayerProfile("", uuid.toString(), create, true);
|
return loadPlayerProfile("", uuid.toString(), false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerProfile loadPlayerProfile(String playerName, UUID uuid, boolean create) {
|
public PlayerProfile loadPlayerProfile(String playerName, UUID uuid, boolean create) {
|
||||||
|
@ -41,7 +41,7 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
|||||||
|
|
||||||
// Increment attempt counter and try
|
// Increment attempt counter and try
|
||||||
attempt++;
|
attempt++;
|
||||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player.getUniqueId(), true);
|
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player.getName(), player.getUniqueId(), true);
|
||||||
// If successful, schedule the apply
|
// If successful, schedule the apply
|
||||||
if (profile.isLoaded()) {
|
if (profile.isLoaded()) {
|
||||||
new ApplySuccessfulProfile(profile).runTask(mcMMO.p);
|
new ApplySuccessfulProfile(profile).runTask(mcMMO.p);
|
||||||
|
Loading…
Reference in New Issue
Block a user