feat: add Player Name to PlayerCache

This commit is contained in:
Simon Giesel 2020-05-09 15:56:46 +02:00
parent e0f71c6a6c
commit d38d9e3e50
2 changed files with 6 additions and 1 deletions

View file

@ -19,6 +19,7 @@ public class PlayerClientOptionsChangeListener implements Listener {
@EventHandler
public void onPlayerClientOptionsChange(final PlayerClientOptionsChangeEvent e) {
final String uuid = e.getPlayer().getUniqueId().toString().replace("-", "");
this.plugin.getPlayerCache().setPlayerCache(uuid, PlayerCacheType.NAME, e.getPlayer().getName());
this.plugin.getPlayerCache().setPlayerCache(uuid, PlayerCacheType.SKINPARTS, e.getSkinParts().getRaw());
this.plugin.getPlayerCache().setPlayerCache(uuid, PlayerCacheType.MAINHAND, e.getMainHand().toString());
}

View file

@ -28,6 +28,10 @@ public class PlayerCache {
savePlayerCache();
}
public String getName(final String uuid) {
return (String) this.playerCache.get("Players." + uuid + "." + PlayerCacheType.NAME.toString());
}
public int getSkinParts(final String uuid) {
return (int) this.playerCache.get("Players." + uuid + "." + PlayerCacheType.SKINPARTS.toString());
}
@ -72,6 +76,6 @@ public class PlayerCache {
}
public enum PlayerCacheType {
SKINPARTS, MAINHAND,
NAME, SKINPARTS, MAINHAND,
}
}