Skip to content

Commit

Permalink
Merge pull request #377 from Mindgamesnl/development
Browse files Browse the repository at this point in the history
6.10.0
  • Loading branch information
Mindgamesnl authored Feb 25, 2024
2 parents d2f688f + 70e3047 commit 1493bfe
Show file tree
Hide file tree
Showing 497 changed files with 8,992 additions and 4,355 deletions.
Binary file modified .github/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions .github/workflows/javadoc-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy Javadoc

on:
push:
branches:
- master
- main
- development # build from development branch (for now)

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Deploy JavaDoc 🚀
uses: MathieuSoysal/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
javadoc-branch: javadoc
java-version: 17
target-folder: javadoc # url will be https://<username>.github.io/<repo>/javadoc, This can be left as nothing to generate javadocs in the root folder.
project: maven # or gradle
subdirectories: api
custom-command: mvn javadoc:aggregate -pl :openaudiomc-api
- name: Ensure docs directory exists
run: mkdir -p docs

- name: Copy API docs
run: cp -r api/target/site/apidocs/* docs/
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ test-server-spigot-legacy/
test-server-bungee/
test-server-vistas/
test-server/
.buildconfig
.buildconfig
javadoc/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Please note that the test for `vistas-server` test cases require a redis server
* **Website** - <https://openaudiomc.net/>
* **Discord Community** - <https://discord.openaudiomc.net/>
* **Documentation** - <https://openaudiomc.net/docs>
* **JavaDocs** - <https://javadoc.openaudiomc.net/>
* **Client** - <https://session.openaudiomc.net/>

# Codebase core terminology
Expand Down
File renamed without changes.
103 changes: 103 additions & 0 deletions api/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>OpenAudioMc-Parent</artifactId>
<groupId>com.craftmend.openaudiomc</groupId>
<version>1.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openaudiomc-api</artifactId>
<name>openaudiomc-api</name>
<version>${oa.version}</version>
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
<finalName>openaudiomc-api</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>1.18.20.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<outputDirectory>${delombok.output}</outputDirectory>
<addOutputDirectory>false</addOutputDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<source>8</source>
<sourcepath>${delombok.output}</sourcepath>
<doclint>none</doclint>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
<delombok.output>${project.build.directory}/delombok</delombok.output>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sourcepath>src/main/java</sourcepath>
</properties>
</project>
125 changes: 125 additions & 0 deletions api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>openaudiomc-api</artifactId>
<version>${oa.version}</version>
<packaging>jar</packaging>
<name>openaudiomc-api</name>

<parent>
<groupId>com.craftmend.openaudiomc</groupId>
<artifactId>OpenAudioMc-Parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.2</version>
</parent>

<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sourcepath>src/main/java</sourcepath>
<delombok.output>${project.build.directory}/delombok</delombok.output>
</properties>

<build>
<finalName>openaudiomc-api</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>1.18.20.0</version>
<configuration>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<outputDirectory>${delombok.output}</outputDirectory>
<addOutputDirectory>false</addOutputDirectory>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<source>8</source>
<sourcepath>${delombok.output}</sourcepath>
<doclint>none</doclint>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>${deps.jetbrainsannot.version}</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${deps.lombok.version}</version>
<scope>provided</scope>
</dependency>

<!-- THIS SHOULD ONLY BE USED IN THE FILTER, NOT IN ANY OTHER INTERFACE WHICH MAY BE USED ON OTHER PLATFORMS -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${deps.spigot.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
55 changes: 55 additions & 0 deletions api/src/main/java/com/craftmend/openaudiomc/api/ApiHolder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.craftmend.openaudiomc.api;

/**
* Internal class used to initialize the API once based on services from the plugin.
* Calling any of these methods will throw an exception if the API is already initiated.
*/
public class ApiHolder {

static ClientApi clientApiInstance;
static WorldApi worldApiInstance;
static VoiceApi voiceApiInstance;
static MediaApi mediaApiInstance;
static EventApi eventApiInstance;

public static void initiate(
ClientApi clientApi
) {
if (clientApiInstance != null) throw new IllegalStateException("Api already initiated");

clientApiInstance = clientApi;
}

public static void initiate(
WorldApi worldApi
) {
if (worldApiInstance != null) throw new IllegalStateException("Api already initiated");

worldApiInstance = worldApi;
}

public static void initiate(
VoiceApi voiceApi
) {
if (voiceApiInstance != null) throw new IllegalStateException("Api already initiated");

voiceApiInstance = voiceApi;
}

public static void initiate(
MediaApi mediaApi
) {
if (mediaApiInstance != null) throw new IllegalStateException("Api already initiated");

mediaApiInstance = mediaApi;
}

public static void initiate(
EventApi eventApi
) {
if (eventApiInstance != null) throw new IllegalStateException("Api already initiated");

eventApiInstance = eventApi;
}

}
47 changes: 47 additions & 0 deletions api/src/main/java/com/craftmend/openaudiomc/api/ClientApi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.craftmend.openaudiomc.api;

import com.craftmend.openaudiomc.api.clients.Client;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;
import java.util.UUID;

/**
* The ClientApi is a collection of methods to interact with clients, and get information about them
*/
public interface ClientApi {

/**
* Get an instance of the client api. May be null if the plugin is not loaded yet
* @return instance
*/
static ClientApi getInstance() {
if (ApiHolder.clientApiInstance == null) {
throw new IllegalStateException("OpenAudioMc has not been initialized yet");
}
return ApiHolder.clientApiInstance;
}

/**
* Get a client by a player UUID, or null if the player is not online or not registered yet
* @param clientUuid the UUID of the player
* @return the client instance, or null if the client is not connected
*/
@Nullable Client getClient(UUID clientUuid);

/**
* Get all clients that are currently known to the server
* @return All clients
*/
@NotNull
Collection<Client> getAllClients();

/**
* Check if a client is registered, and has an active web connection
* @param uuid the UUID of the player
* @return true if the player is connected, false if not or not registered
*/
boolean isConnected(UUID uuid);

}
Loading

0 comments on commit 1493bfe

Please sign in to comment.