mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-03 21:15:28 +02:00
WIP of reworking classes involved in querying data, also some work done to the party code rewrite
This commit is contained in:
@@ -31,7 +31,7 @@ public class FormulaConversionTask extends BukkitRunnable {
|
||||
|
||||
// If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||
if (mmoPlayer == null) {
|
||||
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false);
|
||||
profile = mcMMO.getDatabaseManager().queryPlayerDataByUUID(playerName, false);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
mcMMO.p.debug("Profile not loaded.");
|
||||
|
@@ -41,33 +41,32 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player.getName(), player.getUniqueId(), true);
|
||||
|
||||
// If successful, schedule the apply
|
||||
if (profile.isLoaded()) {
|
||||
try {
|
||||
PlayerProfile profile = mcMMO.getDatabaseManager().queryPlayerDataByUUID(player.getUniqueId());
|
||||
new ApplySuccessfulProfile(new McMMOPlayer(player, profile)).runTask(mcMMO.p);
|
||||
EventUtils.callPlayerProfileLoadEvent(player, profile);
|
||||
return;
|
||||
|
||||
} catch () {
|
||||
// Print errors to console/logs if we're failing at least 2 times in a row to load the profile
|
||||
if (attempt >= 3)
|
||||
{
|
||||
//Log the error
|
||||
mcMMO.p.getLogger().severe(LocaleLoader.getString("Profile.Loading.FailureNotice",
|
||||
player.getName(), String.valueOf(attempt)));
|
||||
|
||||
//Notify the admins
|
||||
mcMMO.p.getServer().broadcast(LocaleLoader.getString("Profile.Loading.FailureNotice", player.getName()), Server.BROADCAST_CHANNEL_ADMINISTRATIVE);
|
||||
|
||||
//Notify the player
|
||||
player.sendMessage(LocaleLoader.getString("Profile.Loading.FailurePlayer", String.valueOf(attempt)).split("\n"));
|
||||
}
|
||||
|
||||
// Increment attempt counter and try
|
||||
attempt++;
|
||||
|
||||
new PlayerProfileLoadingTask(player, attempt).runTaskLaterAsynchronously(mcMMO.p, (100 + (attempt * 100)));
|
||||
}
|
||||
|
||||
// Print errors to console/logs if we're failing at least 2 times in a row to load the profile
|
||||
if (attempt >= 3)
|
||||
{
|
||||
//Log the error
|
||||
mcMMO.p.getLogger().severe(LocaleLoader.getString("Profile.Loading.FailureNotice",
|
||||
player.getName(), String.valueOf(attempt)));
|
||||
|
||||
//Notify the admins
|
||||
mcMMO.p.getServer().broadcast(LocaleLoader.getString("Profile.Loading.FailureNotice", player.getName()), Server.BROADCAST_CHANNEL_ADMINISTRATIVE);
|
||||
|
||||
//Notify the player
|
||||
player.sendMessage(LocaleLoader.getString("Profile.Loading.FailurePlayer", String.valueOf(attempt)).split("\n"));
|
||||
}
|
||||
|
||||
// Increment attempt counter and try
|
||||
attempt++;
|
||||
|
||||
new PlayerProfileLoadingTask(player, attempt).runTaskLaterAsynchronously(mcMMO.p, (100 + (attempt * 100)));
|
||||
}
|
||||
|
||||
private class ApplySuccessfulProfile extends BukkitRunnable {
|
||||
@@ -86,7 +85,6 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
||||
return;
|
||||
}
|
||||
|
||||
mmoPlayer.setupPartyData();
|
||||
mcMMO.getUserManager().track(mmoPlayer);
|
||||
mmoPlayer.actualizeRespawnATS();
|
||||
|
||||
|
@@ -39,9 +39,9 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
||||
if (player != null
|
||||
&& !Misc.isNPCEntityExcludingVillagers(player)
|
||||
&& Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CATALYSIS)
|
||||
&& mcMMO.getUserManager().getPlayer(player) != null) {
|
||||
&& mcMMO.getUserManager().queryMcMMOPlayer(player) != null) {
|
||||
|
||||
double catalysis = mcMMO.getUserManager().getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkillType.ALCHEMY));
|
||||
double catalysis = mcMMO.getUserManager().queryMcMMOPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkillType.ALCHEMY));
|
||||
|
||||
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
Reference in New Issue
Block a user