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