From c90df76f3c2fa3d49d9fc480db5c29605cc3ed5b Mon Sep 17 00:00:00 2001 From: Zrips Date: Wed, 15 Feb 2017 12:23:24 +0200 Subject: [PATCH] Update players name in real time --- com/gamingmesh/jobs/container/JobsPlayer.java | 2 +- com/gamingmesh/jobs/container/PlayerInfo.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/com/gamingmesh/jobs/container/JobsPlayer.java b/com/gamingmesh/jobs/container/JobsPlayer.java index 22eb8a81..45dbe915 100644 --- a/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/com/gamingmesh/jobs/container/JobsPlayer.java @@ -319,7 +319,7 @@ public class JobsPlayer { * @return the userName */ public String getUserName() { - if (userName == null && player != null) + if (player != null) userName = player.getName(); if (userName == null && OffPlayer != null) userName = OffPlayer.getName(); diff --git a/com/gamingmesh/jobs/container/PlayerInfo.java b/com/gamingmesh/jobs/container/PlayerInfo.java index a4b64b2f..48a158cf 100644 --- a/com/gamingmesh/jobs/container/PlayerInfo.java +++ b/com/gamingmesh/jobs/container/PlayerInfo.java @@ -2,21 +2,29 @@ package com.gamingmesh.jobs.container; import java.util.UUID; +import com.gamingmesh.jobs.Jobs; + public class PlayerInfo { int id; String name = "Unknown"; private Long seen; private UUID uuid; + private JobsPlayer player; public PlayerInfo(String name, int id, UUID uuid, Long seen) { this.name = name; this.id = id; this.uuid = uuid; this.seen = seen; + player = Jobs.getPlayerManager().getJobsPlayer(uuid); } public String getName() { + if (player == null) + player = Jobs.getPlayerManager().getJobsPlayer(uuid); + if (player != null) + return player.getUserName(); return name; }