Apollo
Developers
Modules
Border

Border Module

Overview

The border module not only enhances Minecraft's current world border system, but also backports all the improvements and vanilla features to Minecraft 1.7 players.

  • Backports all vanilla Minecraft world border functionality, found in 1.8+ to the 1.7 version of Lunar Client.
    • All vanilla features such as preventing entry/exit and border expansion/shrinkage are supported.
  • Adds improvements to further customize the vanilla world border, in addition to being able to create and customize Lunar Client world borders.
    • Custom border colors can be provided.
    • Ability to generate and display multiple world borders at once.

Integration

Sample Code

public void displayBorderExample(Player viewer) {
    Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
 
    apolloPlayerOpt.ifPresent(apolloPlayer -> {
        this.borderModule.displayBorder(apolloPlayer, Border.builder()
            .id("pvp-tagged-spawn")
            .world("world")
            .cancelEntry(true)
            .cancelExit(true)
            .canShrinkOrExpand(false)
            .color(Color.RED)
            .bounds(Cuboid2D.builder()
                .minX(-50)
                .minZ(-50)
                .maxX(50)
                .maxZ(50)
                .build()
            )
            .durationTicks(1000)
            .build()
        );
    });
}

Border Options

.id(String) should include a unique identifier for the border. It's important when you have multiple borders in a single world.

.id("pvp-tagged-spawn")

.world(String) is the world, by name, that you wish to add the border to.

.world("world")

.cancelEntry(boolean) is a boolean option to prevent players from entering the border, if they're outside the border bounds.

.cancelEntry(true)

.cancelExit(boolean) is a boolean option to prevent players from exiting the border, if they're currently inside the border bounds.

.cancelExit(true)

.canShrinkOrExpand(boolean) is a boolean option to control if the border has the ability to expand or shrink.

.canShrinkOrExpand(false)

.color(java.awt.Color) is how you dictate the color of the border. See the colors page for more.

Color Types

The java.awt.Color class statically exposes some colors, although they do not correspond to any existing colors used in Minecraft.

.color(Color.CYAN)

.bounds(Cuboid2D) is used to determine the bounds of the border, using a 2D cuboid. See the cuboids page for more.

.bounds(Cuboid2D.builder()
    .minX(-50)
    .minZ(-50)
    .maxX(50)
    .maxZ(50)
    .build()
)

.durationTicks(Integer) is used to determine the speed of expansion or shrinkage.

.durationTicks(0)

Removing a specific border for a player

public void removeBorderExample(Player viewer) {
    Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
    apolloPlayerOpt.ifPresent(apolloPlayer -> this.borderModule.removeBorder(apolloPlayer, "pvp-tagged-spawn"));
}

Resetting all borders for a player

public void resetBordersExample(Player viewer) {
    Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
    apolloPlayerOpt.ifPresent(this.borderModule::resetBorders);
}