From d38d9e3e50d8c2818f70ed535af6e7ca61021446 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 9 May 2020 15:56:46 +0200 Subject: [PATCH] feat: add Player Name to PlayerCache --- .../varo/listeners/PlayerClientOptionsChangeListener.java | 1 + .../src/main/java/de/cliffbreak/varo/uitls/PlayerCache.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerClientOptionsChangeListener.java b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerClientOptionsChangeListener.java index 8a0d2ed..f3f3c74 100644 --- a/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerClientOptionsChangeListener.java +++ b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerClientOptionsChangeListener.java @@ -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()); } diff --git a/varo/src/main/java/de/cliffbreak/varo/uitls/PlayerCache.java b/varo/src/main/java/de/cliffbreak/varo/uitls/PlayerCache.java index 15bc385..87f65e0 100644 --- a/varo/src/main/java/de/cliffbreak/varo/uitls/PlayerCache.java +++ b/varo/src/main/java/de/cliffbreak/varo/uitls/PlayerCache.java @@ -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, } } \ No newline at end of file