Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

txmydev/easy-apollo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Abyss Lunar Addon

The only needed addon to start using Apollo.

Usages

You can use Abyss as an api or use the plugin which includes commands and multiple HCF plugins hooks for rallys, koths, etc.

Using the plugin

Download the plugin from releases page and install it in your server, the first time it will search for Apollo dependency, if not found it will be downloaded, If apollo cannot be started after downloading it, then the server will restart to ensure Apollo is loaded.

Using the API

git clone https://github.com/Contrum/AbyssLunarAddon && cd AbyssLunarAddon
mvn clean install

Usage

Maven

<dependencies>
    <dependency>
        <groupId>org.contrum.abyss</groupId>
        <artifactId>api</artifactId>
        <version>1.0.0</version>
        <scope>compile</scope>
    </dependency>
</dependencies>

Gradle

dependencies {
    implementation 'org.contrum.abyss.api:1.0.0'
}

Example API Usage

import com.lunarclient.apollo.BukkitApollo;
import com.lunarclient.apollo.common.cuboid.Cuboid2D;
import com.lunarclient.apollo.module.waypoint.Waypoint;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.contrum.abyss.AbyssLoader;
import org.contrum.abyss.AbyssLoaderOptions;
import event.org.contrum.org.contrum.abyss.AbyssLoadEvent;
import modules.org.contrum.org.contrum.abyss.AbyssBorderModule;
import modules.org.contrum.org.contrum.abyss.AbyssCombatModule;
import modules.org.contrum.org.contrum.abyss.AbyssTitleModule;
import modules.org.contrum.org.contrum.abyss.AbyssWaypointModule;

import java.awt.*;
import java.time.Duration;

public class ExampleAbbysPlugin extends JavaPlugin implements Listener {

    private AbyssLoader loader;

    @Override
    public void onEnable() {
        this.loader = new AbyssLoader(this,
                AbyssLoaderOptions.builder()
                        .downloadIfMissing(true)
                        .restartUponLoadingError(true)
                        .progressReport(progress -> "Downloading apollo-bukkit... (" + progress + "%/100%)")
                        .errorReport(throwable -> "Error ocurred while downloading apollo-bukkit, " + throwable.getLocalizedMessage())
                        .finishedReport(bytes -> "Completed downloading apollo-bukkit, attempting to initiate the plugin restarting the server..")
                        .build());

        this.getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onAbyssLoad(AbyssLoadEvent event) {
        // You can start using the api
        AbyssBorderModule borderModule = loader.getBorderModule();
        borderModule.setBorder(Bukkit.getWorld("world"), "world-border", Cuboid2D.builder()
                .minX(-1000)
                .minZ(-1000)
                .maxX(1000)
                .maxZ(1000)
                .build(), Color.decode("#ffc0cb"));

        AbyssCombatModule combatModule = loader.getCombatModule();
        combatModule.setDisableHitMissPenalty(true);

        AbyssWaypointModule waypointModule = loader.getWaypointModule();
        Location kothLocation = new Location(this.getServer().getWorld("world"), 1500, 64, 1500);
        waypointModule.addWaypoint("koth", Waypoint.builder()
                .name("Koth")
                .color(Color.RED)
                .location(BukkitApollo.toApolloBlockLocation(kothLocation))
                .preventRemoval(false)
                .hidden(false)
                .build());

        loader.perform(Bukkit.getOnlinePlayers(), (player, runningLunar) -> {
            if (!runningLunar) {
                player.sendMessage(ChatColor.RED + "You are not running Lunar Client, please consider using it to improve your experience.");
            } else {
                AbyssTitleModule titleModule = loader.getTitleModule();
                titleModule.sendTitle(player, "You are running", "Lunar Client!", Duration.ofSeconds(1), Duration.ofSeconds(1), Duration.ofSeconds(1), 1.0f);
            }
        });
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages