Implement a number of small fixes

This commit is contained in:
2025-12-17 11:56:14 +01:00
parent ac334ccd6d
commit a88364d190
4 changed files with 24 additions and 4 deletions
@@ -32,6 +32,17 @@ public class SkillEnginePlayerEvents {
}
}
@SubscribeEvent
public static void onClone(PlayerEvent.Clone event) {
if (event.getEntity() instanceof ServerPlayer newPlayer && event.getOriginal() instanceof ServerPlayer oldPlayer) {
oldPlayer.getCapability(SkillEngineCapabilities.PLAYER_SKILLS).ifPresent(oldData ->
newPlayer.getCapability(SkillEngineCapabilities.PLAYER_SKILLS).ifPresent(newData -> {
newData.load(oldData.save());
})
);
}
}
@SubscribeEvent
public static void onRespawn(PlayerEvent.PlayerRespawnEvent event) {
if (event.getEntity() instanceof ServerPlayer player) {