Apollo
Developers
General

General

Common Patterns

These are general features and how-to's inside of Apollo. You will see these options appear throughout Apollo and while reading the documentation.

We recommend you use and understand these general features.

Player

Checking if player is running Lunar Client

boolean runningLunarClient = Apollo.getPlayerManager().hasSupport(player.getUniqueId());

Getting an ApolloPlayer object by player UUID

Optional<ApolloPlayer> apolloPlayer = Apollo.getPlayerManager().getPlayer(player.getUniqueId());

Get all players running Lunar Client

Collection<ApolloPlayer> playersRunningLunarClient = Apollo.getPlayerManager().getPlayers();

Module

Get a specific module

BorderModule borderModule = Apollo.getModuleManager().getModule(BorderModule.class);

Recipients

Creating recipients with a single Apollo Player

apolloPlayer.ifPresent(apolloPlayerObject -> {
    Recipients recipients = apolloPlayerObject;
});

Creating recipients with all players running Lunar Client

Recipients allRecipients = Recipients.ofEveryone();

Creating recipients with all players running Lunar Client with names shorter than 6 characters

Recipients filteredRecipients = Recipients.of(
    Apollo.getPlayerManager().getPlayers().stream()
        .filter(online -> online.getName().length() < 6)
        .collect(Collectors.toList())
);