Platform Utilities

Platform Utilities

Platform utility classes provide helpful platform specific methods to improve your experience when creating an Apollo integration.

The following utility classes are available for each respective platform: BukkitApollo, BungeeApollo, VelocityApollo


You must ensure these methods are only used on the platform they're intended for, otherwise you will encounter errors from missing platform specific dependencies.

runForPlayer Method

The runForPlayer method is a shorthand for converting a player instance from the platform to an ApolloPlayer to run an operation in a Consumer.

public void runPlayerExample(Player player) {
    BukkitApollo.runForPlayer(player, apolloPlayer -> {
        /* Operation goes here! */

getRecipientsFrom Method

The getRecipientsFrom method is a shorthand for converting a collection of player instances from the platform to a collection of Recipients.

public void runRecipientsExample(Collection<Player> players, UUID burningPlayer) {
    Recipients recipients = BukkitApollo.getRecipientsFrom(players);

toApolloLocation Method

The toApolloLocation method is a way of converting a Location to an ApolloLocation.

public void runLocationExample(Location location) {
    ApolloLocation apolloLocation = BukkitApollo.toApolloLocation(location);
    this.hologramModule.displayHologram(Recipients.ofEveryone(), Hologram.builder()
                .content("Welcome to my server!")
                .decorate(TextDecoration.BOLD, TextDecoration.UNDERLINED)
                .content("Type /help to get started!")

toApolloBlockLocation Method

The toApolloBlockLocation method is a way of converting a platform specific Location to an ApolloBlockLocation.

public void runBlockLocationExample(ApolloPlayer apolloPlayer, Location location) {
    ApolloBlockLocation apolloLocation = BukkitApollo.toApolloBlockLocation(location);
    this.waypointModule.displayWaypoint(apolloPlayer, Waypoint.builder()
        .preventRemoval(false) // If the player can delete the waypoint

toApolloEntity Method

The toApolloEntity method is a way of converting a Bukkit Entity to an ApolloEntity.

public void runEntityExample(Player player, ApolloPlayer apolloPlayer) {
    List<ApolloEntity> sheepEntities = player.getWorld().getEntitiesByClass(Sheep.class)
    this.entityModule.overrideRainbowSheep(apolloPlayer, sheepEntities);

toBukkitLocation Method

The toBukkitLocation method is a way of converting an ApolloLocation, ApolloBlockLocation or ApolloPlayerLocation back to a platform specific Location.