mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Offload slightly more calculations to the async loading thread. kinda Fixes #2591
This commit is contained in:
parent
4e013b44d8
commit
12cb1e4161
@ -101,12 +101,6 @@ public class McMMOPlayer {
|
|||||||
this.player = player;
|
this.player = player;
|
||||||
playerMetadata = new FixedMetadataValue(mcMMO.p, playerName);
|
playerMetadata = new FixedMetadataValue(mcMMO.p, playerName);
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
party = PartyManager.getPlayerParty(playerName, uuid);
|
|
||||||
ptpRecord = new PartyTeleportRecord();
|
|
||||||
|
|
||||||
if (inParty()) {
|
|
||||||
loginParty();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (profile.getUniqueId() == null) {
|
if (profile.getUniqueId() == null) {
|
||||||
profile.setUniqueId(uuid);
|
profile.setUniqueId(uuid);
|
||||||
@ -532,6 +526,15 @@ public class McMMOPlayer {
|
|||||||
* Party Stuff
|
* Party Stuff
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public void setupPartyData() {
|
||||||
|
party = PartyManager.getPlayerParty(player.getName(), player.getUniqueId());
|
||||||
|
ptpRecord = new PartyTeleportRecord();
|
||||||
|
|
||||||
|
if (inParty()) {
|
||||||
|
loginParty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setPartyInvite(Party invite) {
|
public void setPartyInvite(Party invite) {
|
||||||
this.invite = invite;
|
this.invite = invite;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
|||||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player.getName(), 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(new McMMOPlayer(player, profile)).runTask(mcMMO.p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,10 +59,10 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class ApplySuccessfulProfile extends BukkitRunnable {
|
private class ApplySuccessfulProfile extends BukkitRunnable {
|
||||||
private final PlayerProfile profile;
|
private final McMMOPlayer mcMMOPlayer;
|
||||||
|
|
||||||
private ApplySuccessfulProfile(PlayerProfile profile) {
|
private ApplySuccessfulProfile(McMMOPlayer mcMMOPlayer) {
|
||||||
this.profile = profile;
|
this.mcMMOPlayer = mcMMOPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Synchronized task
|
// Synchronized task
|
||||||
@ -74,7 +74,7 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = new McMMOPlayer(player, profile);
|
mcMMOPlayer.setupPartyData();
|
||||||
UserManager.track(mcMMOPlayer);
|
UserManager.track(mcMMOPlayer);
|
||||||
mcMMOPlayer.actualizeRespawnATS();
|
mcMMOPlayer.actualizeRespawnATS();
|
||||||
ScoreboardManager.setupPlayer(player);
|
ScoreboardManager.setupPlayer(player);
|
||||||
|
Loading…
Reference in New Issue
Block a user