Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a Paper listener for the PlayerClientOptionsChangeEvent event
- Loading branch information
1 parent
2d32528
commit 38f4953
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
bukkit/src/main/java/com/georgev22/skinoverlay/listeners/bukkit/PaperPlayerListeners.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.georgev22.skinoverlay.listeners.bukkit; | ||
|
||
import com.destroystokyo.paper.event.player.PlayerClientOptionsChangeEvent; | ||
import com.georgev22.skinoverlay.SkinOverlay; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
|
||
public class PaperPlayerListeners implements Listener { | ||
|
||
private final SkinOverlay skinOverlay = SkinOverlay.getInstance(); | ||
|
||
@EventHandler | ||
public void onPLayerClientOptionsChange(PlayerClientOptionsChangeEvent event) { | ||
if (!event.getPlayer().isOnline()) { | ||
return; | ||
} | ||
if (event.hasSkinPartsChanged()) { | ||
skinOverlay.getPlayer(event.getPlayer().getUniqueId()).orElseThrow().updateSkin(); | ||
} | ||
} | ||
|
||
} |