Search in sources :

Example 1 with MissingPipelineException

use of com.djrapitops.plan.exceptions.MissingPipelineException in project Plan by plan-player-analytics.

the class BukkitEventPipelineModule method mapToPlayerJoin.

private PlayerJoin mapToPlayerJoin(DataService service, PlayerJoinEvent event) {
    UUID playerUUID = event.getPlayer().getUniqueId();
    Optional<PlayerMetadata> metadata = service.map(playerUUID, event.getPlayer(), PlayerMetadata.class);
    return PlayerJoin.builder().playerUUID(playerUUID).serverUUID(service.pullWithoutId(ServerUUID.class).orElseThrow(MissingPipelineException::new)).playerMetadata(metadata.orElseThrow(MissingPipelineException::new)).time(System.currentTimeMillis()).build();
}
Also used : ServerUUID(com.djrapitops.plan.identification.ServerUUID) PlayerMetadata(com.djrapitops.plan.gathering.domain.PlayerMetadata) MissingPipelineException(com.djrapitops.plan.exceptions.MissingPipelineException) ServerUUID(com.djrapitops.plan.identification.ServerUUID) UUID(java.util.UUID)

Example 2 with MissingPipelineException

use of com.djrapitops.plan.exceptions.MissingPipelineException in project Plan by plan-player-analytics.

the class BukkitEventPipelineModule method mapToPlayerLeave.

private PlayerLeave mapToPlayerLeave(DataService service, PlayerQuitEvent event) {
    UUID playerUUID = event.getPlayer().getUniqueId();
    Optional<PlayerMetadata> metadata = service.map(playerUUID, event.getPlayer(), PlayerMetadata.class);
    return PlayerLeave.builder().playerUUID(playerUUID).serverUUID(service.pullWithoutId(ServerUUID.class).orElseThrow(MissingPipelineException::new)).playerMetadata(metadata.orElseThrow(MissingPipelineException::new)).time(System.currentTimeMillis()).build();
}
Also used : ServerUUID(com.djrapitops.plan.identification.ServerUUID) PlayerMetadata(com.djrapitops.plan.gathering.domain.PlayerMetadata) MissingPipelineException(com.djrapitops.plan.exceptions.MissingPipelineException) ServerUUID(com.djrapitops.plan.identification.ServerUUID) UUID(java.util.UUID)

Aggregations

MissingPipelineException (com.djrapitops.plan.exceptions.MissingPipelineException)2 PlayerMetadata (com.djrapitops.plan.gathering.domain.PlayerMetadata)2 ServerUUID (com.djrapitops.plan.identification.ServerUUID)2 UUID (java.util.UUID)2