mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 22:15:45 +00:00
cache profiles earlier on login
This commit is contained in:
1 file changed
+5
-1
@@ -51,9 +51,13 @@ public class PaperPlayerJoinListener implements Listener {
|
|||||||
this.userManager = userManager;
|
this.userManager = userManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void cacheProfile(final PlayerJoinEvent event) {
|
||||||
|
this.profileCache.cache(event.getPlayer().getUniqueId(), event.getPlayer().getName());
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onJoin(final PlayerJoinEvent event) {
|
public void onJoin(final PlayerJoinEvent event) {
|
||||||
this.profileCache.cache(event.getPlayer().getUniqueId(), event.getPlayer().getName());
|
|
||||||
this.userManager.user(event.getPlayer().getUniqueId()).thenAccept(result -> {
|
this.userManager.user(event.getPlayer().getUniqueId()).thenAccept(result -> {
|
||||||
Optional.ofNullable(result.displayName()).ifPresent(displayName -> {
|
Optional.ofNullable(result.displayName()).ifPresent(displayName -> {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
|||||||
Reference in new issue
Block a user