Skip to content

Commit

Permalink
Fix async events
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiao-MoMi committed Jul 3, 2024
1 parent a800481 commit 3000b26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ public void onPlayerJoin(PlayerJoinEvent event) {
if (player == null || !player.isOnline()) return;
var onlineUser = new OnlineUser(player, playerData);
this.putOnlineUserInMap(onlineUser);
NameplateDataLoadEvent syncEvent = new NameplateDataLoadEvent(uuid, onlineUser);
plugin.getServer().getPluginManager().callEvent(syncEvent);
plugin.getScheduler().runTaskAsync(() -> {
NameplateDataLoadEvent syncEvent = new NameplateDataLoadEvent(uuid, onlineUser);
plugin.getServer().getPluginManager().callEvent(syncEvent);
});
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public StorageType getStorageType() {

@Override
public CompletableFuture<Optional<PlayerData>> getPlayerData(UUID uuid) {
return CompletableFuture.completedFuture(Optional.empty());
return CompletableFuture.completedFuture(Optional.of(PlayerData.empty()));
}

@Override
Expand Down

0 comments on commit 3000b26

Please sign in to comment.