mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +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
|
* @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();
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user