Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
![](https://i.imgur.com/VdgyD5m.png)
# Apollo
[![Discord](https://img.shields.io/discord/1080556677004271666?logo=discord&label=discord)](https://lunarclient.dev/discord)
[![Latest Release](https://img.shields.io/github/v/release/LunarClient/Apollo.svg)](https://github.com/LunarClient/Apollo/releases)
[![License](https://img.shields.io/github/license/LunarClient/Apollo.svg)](https://github.com/LunarClient/Apollo/blob/master/license.txt)

Apollo is a powerful tool that allows developers to create custom integrations with Lunar Client.

**Resources**
- [Documentation & Wiki](https://lunarclient.dev/apollo/introduction)
- [Downloads](https://lunarclient.dev/apollo/downloads)
- [Maven Repository](https://lunarclient.dev/maven-repository)

## Integration

### API Integration
Use the **Apollo API** directly by depending on it from our [Maven repository](https://lunarclient.dev/maven-repository).
This is the most straightforward way to create plugins and modules that communicate with Lunar Client.

See the [Waypoint module integration guide](https://lunarclient.dev/apollo/developers/modules/waypoint#integration) for a complete example.

### Lightweight Integration
Our **Lightweight integration** allows you to use Apollo features **without running the Apollo plugin**.
This is useful for developers who want Apollo functionality but prefer a more minimal approach.

There are two supported methods:
- [Lightweight JSON](https://lunarclient.dev/apollo/developers/lightweight/json/getting-started)
- [Lightweight Protobuf](https://lunarclient.dev/apollo/developers/lightweight/protobuf/getting-started)

Both approaches achieve the same goal, but with different trade-offs in terms of **complexity and flexibility**.

Read the [Lightweight introduction](https://lunarclient.dev/apollo/developers/lightweight/introduction) documentation to get started.

## Examples

Apollo includes example plugins to help you get started quickly.
These are the **same projects used for the code examples in the official documentation** on [lunarclient.dev](https://lunarclient.dev/apollo/introduction/).

Each module page on the documentation site shows how to use **API**, **Lightweight JSON**, and **Lightweight Protobuf** integrations, with code pulled directly from these projects.

### Bukkit
- API example → `example/bukkit/api/build/libs`
- Lightweight JSON example → `example/bukkit/json/build/libs`
- Lightweight Protobuf example → `example/bukkit/protos/build/libs`

### Minestom
- API example server → `example/minestom/api/build/libs`

## Building

Apollo uses [Gradle](https://gradle.org/) to handle dependencies and compile the project.

**Prerequisites**

- Java 8 JDK
- Build Tools for Spigot 1.8.8

**Compiling**

Running the following will compile the Apollo source for Java 8.

```shell
./gradlew build
```

The compiled jars will be available in build/libs for each platform:

- Bukkit: `platform/bukkit/plugin/build/libs`
- Folia: `platform/folia/build/libs`
- Minestom: `platform/minestom/build/libs`
- BungeeCord: `platform/bungee/build/libs`
- Velocity: `platform/velocity/build/libs`

## Contributing

The Apollo project is split into several modules.

- **API** - The publicly available interface for developers wishing to create custom integrations with Lunar Client.
- **Common** - The abstraction used by platform modules to reduce duplicate code and implement the protocol for Lunar Client.
- **Bukkit, Folia, Minestom, BungeeCord, Velocity** - Are modules that implement the common module for each respective platform.

Contributions can be made to Apollo by creating a pull request for improvements or fixes. For new feature ideas please consider making a
suggestion by creating an [issue](https://github.com/LunarClient/Apollo/issues) or joining our [discord](https://lunarclient.dev/discord).

## License

Apollo is licensed under the [MIT license](https://github.com/LunarClient/Apollo/blob/master/license.txt).
17 changes: 5 additions & 12 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ jobs:
distribution: "zulu"
java-version: 8

- name: Setup BuildTools
run: |
mkdir ~/buildtools
cd ~/buildtools
wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar -O BuildTools.jar
java -jar BuildTools.jar --rev 1.8.8

- name: Gradle Build
run: ./gradlew build

Expand Down Expand Up @@ -62,8 +55,8 @@ jobs:
target_commitish: "${{ github.sha }}"
generate_release_notes: true
files: |
bukkit/build/libs/apollo-bukkit-${{ env.VERSION }}.jar
bungee/build/libs/apollo-bungee-${{ env.VERSION }}.jar
velocity/build/libs/apollo-velocity-${{ env.VERSION }}.jar
folia/build/libs/apollo-folia-${{ env.VERSION }}.jar
minestom/build/libs/apollo-minestom-${{ env.VERSION }}.jar
platform/bukkit/build/libs/apollo-bukkit-${{ env.VERSION }}.jar
platform/bungee/build/libs/apollo-bungee-${{ env.VERSION }}.jar
platform/velocity/build/libs/apollo-velocity-${{ env.VERSION }}.jar
platform/folia/build/libs/apollo-folia-${{ env.VERSION }}.jar
platform/minestom/build/libs/apollo-minestom-${{ env.VERSION }}.jar
53 changes: 0 additions & 53 deletions README.md

This file was deleted.

1 change: 0 additions & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies {

"bukkit"(main.output)
"bukkit"(libs.bukkit.api)
"bukkit"(libs.bukkit)

"bungee"(main.output)
"bungee"(libs.bungee)
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/lightweight/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Lightweight

Our lightweight integration allows for Apollo features to be used, without the need for running the entire Apollo plugin. We will introduce you to two different methods that achieve the same goal, while utilizing separate approaches. Each method offers different trade-offs between complexity, flexibility, and performance. Choose the method that best fits your use case and environment.
Our lightweight integration allows for Apollo features to be used, without the need for running the entire Apollo plugin. We will introduce you to two different methods that achieve the same goal, while utilizing separate approaches. Each method offers different trade-offs between complexity and flexibility. Choose the method that best fits your use case and environment.

## Message format

Expand Down
1 change: 0 additions & 1 deletion example/bukkit/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ java {
}

dependencies {
compileOnly(libs.bukkit)
compileOnly(libs.bukkit.api)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
*/
package com.lunarclient.apollo.example.util;

import net.minecraft.server.v1_8_R3.NBTTagCompound;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

Expand All @@ -42,30 +40,31 @@ public static ItemStack itemWithName(Material material, String name) {
}

public static ItemStack addTag(ItemStack item, String key, Object value) {
net.minecraft.server.v1_8_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
NBTTagCompound tag = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();

NBTTagCompound lunarTag = tag.getCompound("lunar");
if (lunarTag == null) {
lunarTag = new NBTTagCompound();
}

if (value instanceof Integer) {
lunarTag.setInt(key, (Integer) value);
} else if (value instanceof Double) {
lunarTag.setDouble(key, (Double) value);
} else if (value instanceof Float) {
lunarTag.setFloat(key, (Float) value);
} else if (value instanceof Boolean) {
lunarTag.setBoolean(key, (Boolean) value);
} else if (value instanceof String) {
lunarTag.setString(key, (String) value);
}

tag.set("lunar", lunarTag);
nmsItem.setTag(tag);

return CraftItemStack.asBukkitCopy(nmsItem);
// net.minecraft.server.v1_8_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
// NBTTagCompound tag = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();
//
// NBTTagCompound lunarTag = tag.getCompound("lunar");
// if (lunarTag == null) {
// lunarTag = new NBTTagCompound();
// }
//
// if (value instanceof Integer) {
// lunarTag.setInt(key, (Integer) value);
// } else if (value instanceof Double) {
// lunarTag.setDouble(key, (Double) value);
// } else if (value instanceof Float) {
// lunarTag.setFloat(key, (Float) value);
// } else if (value instanceof Boolean) {
// lunarTag.setBoolean(key, (Boolean) value);
// } else if (value instanceof String) {
// lunarTag.setString(key, (String) value);
// }
//
// tag.set("lunar", lunarTag);
// nmsItem.setTag(tag);
//
// return CraftItemStack.asBukkitCopy(nmsItem);
return item;
}

private ItemUtil() {
Expand Down
2 changes: 1 addition & 1 deletion example/bukkit/json/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
exclude("net.kyori", "adventure-bom")
}

compileOnly(libs.bukkit)
compileOnly(libs.bukkit.api)
compileOnly(libs.folia)
implementation(project(":example:bukkit:apollo-example-bukkit-common"))
}
2 changes: 1 addition & 1 deletion example/bukkit/proto/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies {
exclude("net.kyori", "adventure-bom")
}

compileOnly(libs.bukkit)
compileOnly(libs.bukkit.api)
compileOnly(libs.folia)
implementation(project(":example:bukkit:apollo-example-bukkit-common"))
}
2 changes: 1 addition & 1 deletion example/minestom/api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ java {

dependencies {
compileOnly(project(path = ":apollo-api", configuration = "minestom"))
implementation(project(path = ":apollo-minestom", configuration = "shadow"))
implementation(project(path = ":platform:apollo-minestom", configuration = "shadow"))

implementation(libs.minestom)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ setupDynamicDependency("baseAdventure4", "baseJarAdventure4", "adventure/4/", "l
setupDynamicDependency("adventure4", "shadowJarAdventure4", "adventure/4/", "dependencies", "adventure4", "all")

dependencies {
compileOnly(libs.bukkit)
compileOnly(libs.bukkit.api)
compileOnly(libs.protobuf)

api(project(path = ":apollo-api", configuration = "shadow"))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 14 additions & 7 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ pluginManagement {
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://us-maven.pkg.dev/mw-lunarclient-maven-repo/public")
mavenCentral()
mavenLocal()
Expand All @@ -35,17 +35,24 @@ listOfNotNull(
"extra:adventure4",
"api",
"common",
"bukkit",
"example:bukkit:common",
"example:bukkit:api",
"example:bukkit:json",
"example:bukkit:proto",
"example:minestom:api",
if (loadAllVersions) "bungee" else null,
if (loadAllVersions) "velocity" else null,
if (loadAllVersions) "folia" else null,
if (loadAllVersions) "minestom" else null
"example:minestom:api"
).forEach {
include(it)
findProject(":$it")?.name = "apollo-${it.replace(':', '-')}"
}


listOfNotNull(
"platform:bukkit",
if (loadAllVersions) "platform:bungee" else null,
if (loadAllVersions) "platform:velocity" else null,
if (loadAllVersions) "platform:folia" else null,
if (loadAllVersions) "platform:minestom" else null
).forEach {
include(it)
findProject(":$it")?.name = "apollo-${it.split(':').last()}"
}