From 50f59d8000b20368d3abac865c47c0d382aa6b14 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 4 May 2020 18:34:33 +0200 Subject: [PATCH] feat: change PlayerCache on ClientOptionChange --- .../PlayerClientOptionsChangeListener.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 varo/src/main/java/de/cliffbreak/varo/listeners/PlayerClientOptionsChangeListener.java diff --git a/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerClientOptionsChangeListener.java b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerClientOptionsChangeListener.java new file mode 100644 index 0000000..1b280b8 --- /dev/null +++ b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerClientOptionsChangeListener.java @@ -0,0 +1,25 @@ +package de.cliffbreak.varo.listeners; + +import com.destroystokyo.paper.event.player.PlayerClientOptionsChangeEvent; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import de.cliffbreak.varo.Varo; +import de.cliffbreak.varo.PlayerCache.PlayerCacheType; + +public class PlayerClientOptionsChangeListener implements Listener { + + private Varo plugin; + + public PlayerClientOptionsChangeListener(Varo plugin) { + this.plugin = plugin; + } + + @EventHandler() + public void onPlayerClientOptionsChange(PlayerClientOptionsChangeEvent e) { + String uuid = e.getPlayer().getUniqueId().toString().replace("-", ""); + plugin.playerCache.setPlayerCache(uuid, PlayerCacheType.SKINPARTS, e.getSkinParts().getRaw()); + plugin.playerCache.setPlayerCache(uuid, PlayerCacheType.MAINHAND, e.getMainHand().toString()); + } +} \ No newline at end of file