Skip to content

Commit

Permalink
Merge pull request #274 from MrJeremyFisher/namelayer-1.20
Browse files Browse the repository at this point in the history
Fix null connection error in NameLayer 1.20
  • Loading branch information
okx-code committed Feb 21, 2024
2 parents 03c2cd0 + 5b6ded0 commit 6c01a6d
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ public void OnPlayerJoin(PlayerJoinEvent event) {
UUID uuid = event.getPlayer().getUniqueId();
associations.addPlayer(playername, uuid);
event.setJoinMessage(ChatColor.YELLOW + NameAPI.getCurrentName(uuid) + " joined the game");
}

@EventHandler(priority = EventPriority.LOWEST)
public void OnPlayerLogin(PlayerLoginEvent event) {
final Player player = event.getPlayer();
MojangNames.declareMojangName(player.getUniqueId(), player.getName());
String name = associations.getCurrentName(player.getUniqueId());
Expand All @@ -71,6 +68,7 @@ public void OnPlayerLogin(PlayerLoginEvent event) {
name = associations.getCurrentName(player.getUniqueId());
}


if (game != null)
game.setPlayerProfile(player, name);
}
Expand Down

0 comments on commit 6c01a6d

Please sign in to comment.