1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-30 21:07:48 +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
*/
public String getUserName() {
if (userName == null && player != null)
if (player != null)
userName = player.getName();
if (userName == null && OffPlayer != null)
userName = OffPlayer.getName();

View File

@ -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;
}