feat: change PlayerCache on ClientOptionChange

This commit is contained in:
Simon Giesel 2020-05-04 18:34:33 +02:00
parent 97a93c2cb0
commit 50f59d8000

View file

@ -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());
}
}