mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Update players name in real time
This commit is contained in:
parent
9851a1267d
commit
c90df76f3c
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user