1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Update players name in real time

This commit is contained in:
Zrips 2017-02-15 12:23:24 +02:00
parent 9851a1267d
commit c90df76f3c
2 changed files with 9 additions and 1 deletions

View File

@ -319,7 +319,7 @@ public class JobsPlayer {
* @return the userName * @return the userName
*/ */
public String getUserName() { public String getUserName() {
if (userName == null && player != null) if (player != null)
userName = player.getName(); userName = player.getName();
if (userName == null && OffPlayer != null) if (userName == null && OffPlayer != null)
userName = OffPlayer.getName(); userName = OffPlayer.getName();

View File

@ -2,21 +2,29 @@ package com.gamingmesh.jobs.container;
import java.util.UUID; import java.util.UUID;
import com.gamingmesh.jobs.Jobs;
public class PlayerInfo { public class PlayerInfo {
int id; int id;
String name = "Unknown"; String name = "Unknown";
private Long seen; private Long seen;
private UUID uuid; private UUID uuid;
private JobsPlayer player;
public PlayerInfo(String name, int id, UUID uuid, Long seen) { public PlayerInfo(String name, int id, UUID uuid, Long seen) {
this.name = name; this.name = name;
this.id = id; this.id = id;
this.uuid = uuid; this.uuid = uuid;
this.seen = seen; this.seen = seen;
player = Jobs.getPlayerManager().getJobsPlayer(uuid);
} }
public String getName() { public String getName() {
if (player == null)
player = Jobs.getPlayerManager().getJobsPlayer(uuid);
if (player != null)
return player.getUserName();
return name; return name;
} }