diff --git a/api/.gitignore b/api/.gitignore
new file mode 100644
index 000000000..a8463100e
--- /dev/null
+++ b/api/.gitignore
@@ -0,0 +1,5 @@
+target/
+target/*
+.DS_Store
+test-storage/
+test-server/
\ No newline at end of file
diff --git a/api/dependency-reduced-pom.xml b/api/dependency-reduced-pom.xml
new file mode 100644
index 000000000..8b9183683
--- /dev/null
+++ b/api/dependency-reduced-pom.xml
@@ -0,0 +1,55 @@
+
+
+
+ OpenAudioMc-Parent
+ com.craftmend.openaudiomc
+ 1.2
+
+ 4.0.0
+ openaudiomc-api
+ openaudiomc-api
+ ${oa.version}
+
+
+
+ true
+ src/main/resources
+
+
+ openaudiomc-api
+
+
+ maven-compiler-plugin
+ 3.8.1
+
+
+ ${java.version}
+
+
+
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.30
+ provided
+
+
+
+ 1.8
+ UTF-8
+
+
diff --git a/api/pom.xml b/api/pom.xml
new file mode 100644
index 000000000..47c8e5591
--- /dev/null
+++ b/api/pom.xml
@@ -0,0 +1,73 @@
+
+
+ 4.0.0
+
+ openaudiomc-api
+ ${oa.version}
+ jar
+ openaudiomc-api
+
+
+ com.craftmend.openaudiomc
+ OpenAudioMc-Parent
+ ../pom.xml
+ 1.2
+
+
+
+ 1.8
+ UTF-8
+
+
+
+ openaudiomc-api
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ ${java.version}
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+
+
+ org.jetbrains
+ annotations
+ 24.1.0
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.30
+ provided
+
+
+
+
\ No newline at end of file
diff --git a/api/src/main/java/com/craftmend/openaudiomc/api/ApiHolder.java b/api/src/main/java/com/craftmend/openaudiomc/api/ApiHolder.java
new file mode 100644
index 000000000..2316d799d
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/ApiHolder.java
@@ -0,0 +1,24 @@
+package com.craftmend.openaudiomc.api;
+
+public class ApiHolder {
+
+ static ClientApi clientApiInstance;
+ static WorldApi worldApiInstance;
+ static VoiceApi voiceApiInstance;
+ static MediaApi mediaApiInstance;
+
+ public static void initiate(
+ ClientApi clientApi,
+ WorldApi worldApi,
+ VoiceApi voiceApi,
+ MediaApi mediaApi
+ ) {
+ if (clientApiInstance != null) throw new IllegalStateException("Api already initiated");
+
+ clientApiInstance = clientApi;
+ worldApiInstance = worldApi;
+ voiceApiInstance = voiceApi;
+ mediaApiInstance = mediaApi;
+ }
+
+}
diff --git a/api/src/main/java/com/craftmend/openaudiomc/api/ClientApi.java b/api/src/main/java/com/craftmend/openaudiomc/api/ClientApi.java
new file mode 100644
index 000000000..974845b1d
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/ClientApi.java
@@ -0,0 +1,41 @@
+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;
+
+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() {
+ 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 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);
+
+}
diff --git a/api/src/main/java/com/craftmend/openaudiomc/api/MediaApi.java b/api/src/main/java/com/craftmend/openaudiomc/api/MediaApi.java
new file mode 100644
index 000000000..151b20452
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/MediaApi.java
@@ -0,0 +1,78 @@
+package com.craftmend.openaudiomc.api;
+
+import com.craftmend.openaudiomc.api.clients.Client;
+import com.craftmend.openaudiomc.api.media.Media;
+import com.craftmend.openaudiomc.api.media.UrlMutation;
+import org.jetbrains.annotations.NotNull;
+
+public interface MediaApi {
+
+ /**
+ * Get an instance of the media api. May be null if the plugin is not loaded yet
+ * @return instance
+ */
+ static MediaApi getInstance() {
+ return ApiHolder.mediaApiInstance;
+ }
+
+ /**
+ * Create a new media instance with a source, and automatically translate the source
+ * (if needed) and register a normalized time for the start instant.
+ *
+ * @param source the source of the media
+ * @return a new media instance
+ */
+ @NotNull
+ Media createMedia(@NotNull String source);
+
+ /**
+ * Translate server-sided aliases, playlists or other sources to a valid source.
+ * This is automatically done by createMedia, but you might want to do this manually.
+ *
+ * @param source the source to translate
+ * @return the translated source
+ */
+ @NotNull
+ String translateSource(@NotNull String source);
+
+ /**
+ * URL mutations can be used to register custom server-side media hooks or source translators.
+ * An example use case would be a custom media server aliased by hypixel:, which can be resolved
+ * to https://hypixel.com/media/* by a mutation.
+ *
+ * @param prefix the prefix to register the mutation for,
+ * the mutation will only be called for media sources starting with this prefix
+ * @param mutation the mutation to register
+ */
+ void registerMutation(@NotNull String prefix, @NotNull UrlMutation mutation);
+
+ /**
+ * Get the current epoch time, but normalized to the start of the current media.
+ * This timecodes is normalized based on heartbeats from an open audio server, to eliminate
+ * timezone changes between this server and the web-client (because the player might be in a different timezone)
+ *
+ * @return the current epoch time, but normalized to the start of the current media
+ */
+ long getNormalizedCurrentEpoch();
+
+ /**
+ * Play a media for a client
+ * @param client Target client
+ * @param media Media instance
+ */
+ void playFor(@NotNull Media media, @NotNull Client... clients);
+
+ /**
+ * Stop all media (except regions and speakers) for a client
+ * @param clients Target clients
+ */
+ void stopFor(@NotNull Client... clients);
+
+ /**
+ * Stop a specific media by ID for a client
+ * @param id Media ID
+ * @param clients Target clients
+ */
+ void stopFor(@NotNull String id, @NotNull Client... clients);
+
+}
diff --git a/api/src/main/java/com/craftmend/openaudiomc/api/VoiceApi.java b/api/src/main/java/com/craftmend/openaudiomc/api/VoiceApi.java
new file mode 100644
index 000000000..0b285eb98
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/VoiceApi.java
@@ -0,0 +1,69 @@
+package com.craftmend.openaudiomc.api;
+
+import com.craftmend.openaudiomc.api.clients.Client;
+import com.craftmend.openaudiomc.api.voice.VoicePeerOptions;
+
+import java.util.UUID;
+
+public interface VoiceApi {
+
+ /**
+ * Get the voice api instance, or null if the plugin is not loaded yet
+ * @return instance
+ */
+ static VoiceApi getInstance() {
+ return ApiHolder.voiceApiInstance;
+ }
+
+ /*
+ * The VoiceApi contains registry, as well as control endpoints for voice-chat related features.
+ * This implementation is only available on the Spigot instance, even if the plugin is running in a BungeeCord/Velocity or Vistas network.
+ * Accessing this API on a non-spigot instance will result in undefined behavior or runtime exceptions.
+ */
+
+ /**
+ * Register a client as a voice-chat peer
+ * @param haystack The client that will be the host
+ * @param needle The client that will be the peer
+ * @return true if the client was registered, false if the client was already registered
+ */
+ boolean hasPeer(Client haystack, Client needle);
+
+ /**
+ * Register a client as a voice-chat peer
+ * @param haystack The client that will be the host
+ * @param needle The client that will be the peer
+ * @return true if the client was registered, false if the client was already registered
+ */
+ boolean hasPeer(Client haystack, UUID needle);
+
+ /**
+ * Push new options for a peer, changing how its rendered in the client
+ * @param client The web client that should receive this update
+ * @param peerToUpdate The peer that should be updated
+ * @param options The new options
+ */
+ void updatePeerOptions(Client client, Client peerToUpdate, VoicePeerOptions options);
+
+ /**
+ * Add a peer (partner) to someone's voice chat.
+ * This would let the client hear the peerToAdd as a global voice (without spatial audio/distance) until it's removed.
+ * @param client The web client that should receive this update
+ * @param peerToAdd The peer that should be added
+ * @param visible Whether the peer should be visible in the client
+ * @param mutual Whether the peer should also hear the client (repeat the call for mutual)
+ */
+ void addStaticPeer(Client client, Client peerToAdd, boolean visible, boolean mutual);
+
+ /**
+ * Remove a global peer from someone's voice chat.
+ * This would remove a static peer if they have been added through addStaticPeer, but not
+ * if they have been added through the regular voice-chat system.
+ * @param client The web client that should receive this update
+ * @param peerToRemove The peer that should be removed
+ * @param mutual Whether the peer should also stop hearing the client (repeat the call for mutual)
+ */
+ void removeStaticPeer(Client client, Client peerToRemove, boolean mutual);
+
+
+}
diff --git a/api/src/main/java/com/craftmend/openaudiomc/api/WorldApi.java b/api/src/main/java/com/craftmend/openaudiomc/api/WorldApi.java
new file mode 100644
index 000000000..6afe45975
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/WorldApi.java
@@ -0,0 +1,42 @@
+package com.craftmend.openaudiomc.api;
+
+import com.craftmend.openaudiomc.api.regions.AudioRegion;
+import com.craftmend.openaudiomc.api.spakers.BasicSpeaker;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+
+public interface WorldApi {
+
+ /**
+ * Get an instance of the world api. May be null if the plugin is not loaded yet
+ * @return instance
+ */
+ static WorldApi getInstance() {
+ return ApiHolder.worldApiInstance;
+ }
+
+ /**
+ * Get all regions at a location
+ * @param x x
+ * @param y y
+ * @param z z
+ * @param world world
+ * @return regions
+ */
+ @NotNull
+ Collection getRegionsAt(int x, int y, int z, @NotNull String world);
+
+ /**
+ * Get a speaker at a location, or null if invalid
+ * @param x x
+ * @param y y
+ * @param z z
+ * @param world world
+ * @return speaker
+ */
+ @Nullable
+ BasicSpeaker getSpeakerAt(int x, int y, int z, @NotNull String world);
+
+}
diff --git a/api/src/main/java/com/craftmend/openaudiomc/api/basic/Actor.java b/api/src/main/java/com/craftmend/openaudiomc/api/basic/Actor.java
new file mode 100644
index 000000000..e1b46dc65
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/basic/Actor.java
@@ -0,0 +1,44 @@
+package com.craftmend.openaudiomc.api.basic;
+
+import java.util.UUID;
+
+public interface Actor {
+
+ /*
+ * An actor is a further abstraction of a User> from within OpenAudioMc.
+ * A user is an object representing a platform specific user whose type is given as a parameter to the user class itself.
+ * An actor is a more abstract version of this, and is used to represent any user, regardless of platform.
+ */
+
+ /**
+ * Get the name of the actor (usually the player name)
+ * @return the name of the actor
+ */
+ String getName();
+
+ /**
+ * Get the unique id of the actor (usually the player uuid)
+ * @return the unique id of the actor
+ */
+ UUID getUniqueId();
+
+ /**
+ * If the actor is an administrator (usually a player with OP if we're running on a spigot host, otherwise determined by the platform)
+ * @return if the actor is an administrator
+ */
+ boolean isAdministrator();
+
+ /**
+ * Check if the actor has a certain permission node. This uses the underlying platform's permission system if available.
+ * @param permissionNode the permission node to check for
+ * @return if the actor has the permission node
+ */
+ boolean hasPermission(String permissionNode);
+
+ /**
+ * Make the actor execute a command. This is usually a wrapper around the platform's command sender system.
+ * @param command the command to execute
+ */
+ void sendMessage(String message);
+
+}
diff --git a/api/src/main/java/com/craftmend/openaudiomc/api/clients/Client.java b/api/src/main/java/com/craftmend/openaudiomc/api/clients/Client.java
new file mode 100644
index 000000000..83be77b03
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/clients/Client.java
@@ -0,0 +1,69 @@
+package com.craftmend.openaudiomc.api.clients;
+
+import com.craftmend.openaudiomc.api.basic.Actor;
+import com.craftmend.openaudiomc.api.media.Media;
+import org.jetbrains.annotations.NotNull;
+
+public interface Client {
+
+ /*
+ * A player session represents the state of an online player and its corresponding web client connection.
+ * It's used to interact with the webclient, determine and change state and hook back into the platform specific user object.
+ */
+
+ /**
+ * Get the actor of the underlying User (usually a player)
+ * @return the actor
+ */
+ Actor getActor();
+
+ /**
+ * Add a on connect handler, which fires when the client gets opened for the player
+ *
+ * @param runnable Handler
+ */
+ void onConnect(Runnable runnable);
+
+ /**
+ * Add a on connect handler, which fires when the client gets closed for by player
+ *
+ * @param runnable Handler
+ */
+ void onDisconnect(Runnable runnable);
+
+ /**
+ * If this client currently has the web session open
+ * @return if the client is connected
+ */
+ boolean isConnected();
+
+ /**
+ * If this session has an active voice chat instance
+ * @return if the client is in a voice chat
+ */
+ boolean hasVoicechatEnabled();
+
+ /**
+ * If this the actor's microphone is muted, false if the actor is not in a voice chat
+ * @return if the microphone is muted
+ */
+ boolean isMicrophoneMuted();
+
+ /**
+ * Get the volume of the client (media volume, 0-100, -1 if unknown or not applicable)
+ * @return the volume
+ */
+ int getVolume();
+
+ /**
+ * If the actor is currently in moderation mode
+ * @return if the actor is moderating
+ */
+ boolean isModerating();
+
+ /**
+ * Play a media for this client
+ * @param media the media to play
+ */
+ void playMedia(@NotNull Media media);
+}
diff --git a/api/src/main/java/com/craftmend/openaudiomc/api/media/Media.java b/api/src/main/java/com/craftmend/openaudiomc/api/media/Media.java
new file mode 100644
index 000000000..f65b3de41
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/media/Media.java
@@ -0,0 +1,121 @@
+package com.craftmend.openaudiomc.api.media;
+
+import com.craftmend.openaudiomc.api.MediaApi;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.UUID;
+
+@Getter
+public class Media {
+
+ /**
+ * Source value for the media. Typically, a web compatible web link or translatable OA value
+ */
+ private final String source;
+
+ /**
+ * The unique id of the media, used by the client to keep track of media pools.
+ * This is a random UUID by default, but can be set to a custom value and will be used to identify the media
+ * for regions, stop commands and other features.
+ */
+ @Setter
+ private String mediaId = UUID.randomUUID().toString();
+
+ /**
+ * An epoch millisecond timestamp of when the media started playing, used by the client to calculate the current position
+ * if keepup is configured (time spent + startAtMillis)
+ */
+ @Setter
+ private long startInstant;
+
+ /**
+ * Keep timeout is the amount of seconds that the openaudiomc plugin runtime should keep track of this media for.
+ * Used to retroactively play media if a client connected too late. optional, -1 by default to disable.
+ */
+ @Setter
+ private transient int keepTimeout = -1;
+
+ /**
+ * If the media should attempt to pick up where its currently according to the time spent since the start instant.
+ */
+ @Setter
+ private boolean doPickup = false;
+
+ /**
+ * If the media should loop (jumping back to startAtMillis and playing again)
+ */
+ @Setter
+ private boolean loop = false;
+
+ /**
+ * Fade time is the amount of milliseconds it takes to fade in or out. 0 by default, but can be used to create smooth transitions
+ * between multiple regions, or to create a fade in effect.
+ */
+ @Setter
+ private int fadeTime = 0;
+
+ /**
+ * The volume of the media, 0-100
+ */
+ @Setter
+ private int volume = 100;
+
+ /**
+ * If this media will mute current regions while playing. This is used to prevent overlapping media in regions.
+ */
+ @Setter
+ private boolean muteRegions = false;
+
+ /**
+ * If this media will mute the speakers of the client. This is used to prevent overlapping media with speakers.
+ */
+ @Setter
+ private boolean muteSpeakers = false;
+
+ /**
+ * The starting point of the media, in milliseconds. 0 by default, but can be used to skip intros or start at a certain point.
+ */
+ @Setter
+ private int startAtMillis = 0;
+
+ /**
+ * The flag of the media, used to identify the type of media. This is used by the client to apply different settings
+ * based on the type of media. This is set to DEFAULT by default, but can be set to REGION or SPEAKER to apply different settings.
+ */
+ @Setter
+ private MediaFlag flag = MediaFlag.DEFAULT;
+
+ /**
+ * Create a new media based on a url
+ * the source will first be processed by the mutation api
+ * so you can just use addons without needing to wor§§ry
+ *
+ * @param source the resource url
+ */
+ public Media(String source) {
+ this.source = MediaApi.getInstance().translateSource(source);
+ this.startInstant = MediaApi.getInstance().getNormalizedCurrentEpoch();
+ }
+
+ /**
+ * You can apply multiple options.
+ * Used by the commands to allow settings via JSON
+ *
+ * @param options The options. Selected via the command
+ * @return instance of self
+ */
+ public Media applySettings(MediaOptions options) {
+ this.loop = options.isLoop();
+ this.keepTimeout = options.getExpirationTimeout();
+ if (options.getId() != null) this.mediaId = options.getId();
+ this.doPickup = options.isPickUp();
+ this.setFadeTime(options.getFadeTime());
+ this.volume = options.getVolume();
+ this.muteRegions = options.isMuteRegions();
+ this.muteSpeakers = options.isMuteSpeakers();
+ this.startAtMillis = options.getStartAtMillis();
+ return this;
+ }
+
+}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/enums/MediaFlag.java b/api/src/main/java/com/craftmend/openaudiomc/api/media/MediaFlag.java
similarity index 72%
rename from plugin/src/main/java/com/craftmend/openaudiomc/generic/media/enums/MediaFlag.java
rename to api/src/main/java/com/craftmend/openaudiomc/api/media/MediaFlag.java
index 2b9f9d56f..1f10ff913 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/enums/MediaFlag.java
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/media/MediaFlag.java
@@ -1,4 +1,4 @@
-package com.craftmend.openaudiomc.generic.media.enums;
+package com.craftmend.openaudiomc.api.media;
/**
* The 3 types of sounds, used by the client to mark the WebAudioType
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/objects/MediaOptions.java b/api/src/main/java/com/craftmend/openaudiomc/api/media/MediaOptions.java
similarity index 94%
rename from plugin/src/main/java/com/craftmend/openaudiomc/generic/media/objects/MediaOptions.java
rename to api/src/main/java/com/craftmend/openaudiomc/api/media/MediaOptions.java
index 978fad665..cb0c16131 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/objects/MediaOptions.java
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/media/MediaOptions.java
@@ -1,4 +1,4 @@
-package com.craftmend.openaudiomc.generic.media.objects;
+package com.craftmend.openaudiomc.api.media;
import lombok.Data;
import lombok.NoArgsConstructor;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/objects/OptionalError.java b/api/src/main/java/com/craftmend/openaudiomc/api/media/OptionalError.java
similarity index 75%
rename from plugin/src/main/java/com/craftmend/openaudiomc/generic/media/objects/OptionalError.java
rename to api/src/main/java/com/craftmend/openaudiomc/api/media/OptionalError.java
index 89ea33ebf..88347625b 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/objects/OptionalError.java
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/media/OptionalError.java
@@ -1,4 +1,4 @@
-package com.craftmend.openaudiomc.generic.media.objects;
+package com.craftmend.openaudiomc.api.media;
import lombok.AllArgsConstructor;
import lombok.Getter;
diff --git a/api/src/main/java/com/craftmend/openaudiomc/api/media/UrlMutation.java b/api/src/main/java/com/craftmend/openaudiomc/api/media/UrlMutation.java
new file mode 100644
index 000000000..eb5373cbe
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/media/UrlMutation.java
@@ -0,0 +1,22 @@
+package com.craftmend.openaudiomc.api.media;
+
+import org.jetbrains.annotations.NotNull;
+
+public interface UrlMutation {
+
+ /*
+ * URL mutations can be used to register custom server-side media hooks or source translators.
+ * An example use case would be a custom media server aliased by hypixel:, which can be resolved
+ * to https://hypixel.com/media/* by a mutation.
+ */
+
+ /**
+ * Translate a custom source to a full media URL.
+ *
+ * @param original The original source as given in the createMedia method or any command
+ * @return the URL that should be used for playback
+ */
+ @NotNull
+ String onRequest(@NotNull String original);
+
+}
diff --git a/api/src/main/java/com/craftmend/openaudiomc/api/regions/AudioRegion.java b/api/src/main/java/com/craftmend/openaudiomc/api/regions/AudioRegion.java
new file mode 100644
index 000000000..183862855
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/regions/AudioRegion.java
@@ -0,0 +1,36 @@
+package com.craftmend.openaudiomc.api.regions;
+
+import com.craftmend.openaudiomc.api.media.Media;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public interface AudioRegion {
+
+ /**
+ * Get the media playing in this region
+ * @return media
+ */
+ @NotNull
+ Media getMedia();
+
+ /**
+ * Get the region id
+ * @return id
+ */
+ @NotNull
+ String getRegionId();
+
+ /**
+ * Get the world this region is in, can be null if its legacy
+ * @return world
+ */
+ @Nullable
+ String getWorld();
+
+ /**
+ * Get the priority of this region
+ * @return priority
+ */
+ int getPriority();
+
+}
diff --git a/api/src/main/java/com/craftmend/openaudiomc/api/spakers/BasicSpeaker.java b/api/src/main/java/com/craftmend/openaudiomc/api/spakers/BasicSpeaker.java
new file mode 100644
index 000000000..ccd365909
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/spakers/BasicSpeaker.java
@@ -0,0 +1,58 @@
+package com.craftmend.openaudiomc.api.spakers;
+
+import com.craftmend.openaudiomc.api.media.Media;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Set;
+import java.util.UUID;
+
+public interface BasicSpeaker {
+
+ /**
+ * Get the location of the speaker
+ * @return location
+ */
+ @NotNull
+ Loc getLocation();
+
+ /**
+ * Get the media that's being played by this speaker
+ * @return media
+ */
+ @NotNull
+ Media getMedia();
+
+ /**
+ * Get the speaker id
+ * @return id
+ */
+ @NotNull
+ UUID getSpeakerId();
+
+ /**
+ * Get the type of speaker (spatial audio, or static)
+ * @return speaker type
+ */
+ SpeakerType getSpeakerType();
+
+ /**
+ * Get extra options for the speaker
+ * @return options
+ */
+ @NotNull
+ Set getExtraOptions();
+
+ /**
+ * Get the radius of the speaker
+ * @return radius
+ */
+ @NotNull
+ Integer getRadius();
+
+ /**
+ * If this speaker is currently directly powered by redstone
+ * @return is powered
+ */
+ boolean isRedstonePowered();
+
+}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/enums/ExtraSpeakerOptions.java b/api/src/main/java/com/craftmend/openaudiomc/api/spakers/ExtraSpeakerOptions.java
similarity index 84%
rename from plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/enums/ExtraSpeakerOptions.java
rename to api/src/main/java/com/craftmend/openaudiomc/api/spakers/ExtraSpeakerOptions.java
index 9c8e5bc4f..6ab32e7bd 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/enums/ExtraSpeakerOptions.java
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/spakers/ExtraSpeakerOptions.java
@@ -1,6 +1,5 @@
-package com.craftmend.openaudiomc.spigot.modules.speakers.enums;
+package com.craftmend.openaudiomc.api.spakers;
-import com.craftmend.openaudiomc.spigot.modules.speakers.objects.Speaker;
import lombok.Getter;
import java.util.Arrays;
@@ -55,20 +54,20 @@ public enum ExtraSpeakerOptions {
@Getter private boolean display;
@Getter private String title;
@Getter private String description;
- private Predicate[] predicates;
+ private Predicate[] predicates;
- ExtraSpeakerOptions(boolean display, String title, String description, Predicate... requirementChecks) {
+ ExtraSpeakerOptions(boolean display, String title, String description, Predicate... requirementChecks) {
this.display = display;
this.title = title;
this.description = description;
this.predicates = requirementChecks;
}
- public boolean isCompatibleWith(Speaker speaker) {
+ public boolean isCompatibleWith(BasicSpeaker speaker) {
return Arrays.stream(this.predicates).allMatch(predicate -> predicate.test(speaker));
}
- public boolean isEnabledFor(Speaker speaker) {
+ public boolean isEnabledFor(BasicSpeaker speaker) {
return speaker.getExtraOptions().contains(this) && isCompatibleWith(speaker);
}
diff --git a/api/src/main/java/com/craftmend/openaudiomc/api/spakers/Loc.java b/api/src/main/java/com/craftmend/openaudiomc/api/spakers/Loc.java
new file mode 100644
index 000000000..d6bce2363
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/spakers/Loc.java
@@ -0,0 +1,56 @@
+package com.craftmend.openaudiomc.api.spakers;
+
+import org.jetbrains.annotations.NotNull;
+
+public interface Loc {
+
+ /**
+ * Get the x coordinate
+ * @return x
+ */
+ int getX();
+
+ /**
+ * Get the y coordinate
+ * @return y
+ */
+ int getY();
+
+ /**
+ * Get the z coordinate
+ * @return z
+ */
+ int getZ();
+
+ /**
+ * Get the world name
+ * @return world
+ */
+ @NotNull
+ String getWorld();
+
+ /**
+ * Set the x coordinate
+ * @param x x
+ */
+ void setX(int x);
+
+ /**
+ * Set the y coordinate
+ * @param y y
+ */
+ void setY(int y);
+
+ /**
+ * Set the z coordinate
+ * @param z z
+ */
+ void setZ(int z);
+
+ /**
+ * Set the world name
+ * @param world world
+ */
+ void setWorld(@NotNull String world);
+
+}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/enums/SpeakerType.java b/api/src/main/java/com/craftmend/openaudiomc/api/spakers/SpeakerType.java
similarity index 83%
rename from plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/enums/SpeakerType.java
rename to api/src/main/java/com/craftmend/openaudiomc/api/spakers/SpeakerType.java
index 484c1028e..34bf84bff 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/enums/SpeakerType.java
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/spakers/SpeakerType.java
@@ -1,4 +1,4 @@
-package com.craftmend.openaudiomc.spigot.modules.speakers.enums;
+package com.craftmend.openaudiomc.api.spakers;
import lombok.Getter;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/objects/VoicePeerOptions.java b/api/src/main/java/com/craftmend/openaudiomc/api/voice/VoicePeerOptions.java
similarity index 96%
rename from plugin/src/main/java/com/craftmend/openaudiomc/generic/client/objects/VoicePeerOptions.java
rename to api/src/main/java/com/craftmend/openaudiomc/api/voice/VoicePeerOptions.java
index 86fdac41e..34bbf64f5 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/objects/VoicePeerOptions.java
+++ b/api/src/main/java/com/craftmend/openaudiomc/api/voice/VoicePeerOptions.java
@@ -1,4 +1,4 @@
-package com.craftmend.openaudiomc.generic.client.objects;
+package com.craftmend.openaudiomc.api.voice;
import lombok.AllArgsConstructor;
import lombok.Data;
diff --git a/api/src/main/java/com/craftmend/openaudiomc/generic/media/objects/Media.java b/api/src/main/java/com/craftmend/openaudiomc/generic/media/objects/Media.java
new file mode 100644
index 000000000..18ec66dd3
--- /dev/null
+++ b/api/src/main/java/com/craftmend/openaudiomc/generic/media/objects/Media.java
@@ -0,0 +1,13 @@
+package com.craftmend.openaudiomc.generic.media.objects;
+
+@Deprecated
+public class Media extends com.craftmend.openaudiomc.api.media.Media {
+
+ /**
+ * @deprecated use Sound instead, this class only exists at this package level for legacy reasons
+ */
+
+ public Media(String source) {
+ super(source);
+ }
+}
diff --git a/modules/gamemode-voice-filter-module/target/classes/com/craftmend/gamemodefilter/OaGamemodeFilter$1.class b/modules/gamemode-voice-filter-module/target/classes/com/craftmend/gamemodefilter/OaGamemodeFilter$1.class
deleted file mode 100644
index a0d11e4ae..000000000
Binary files a/modules/gamemode-voice-filter-module/target/classes/com/craftmend/gamemodefilter/OaGamemodeFilter$1.class and /dev/null differ
diff --git a/modules/gamemode-voice-filter-module/target/classes/com/craftmend/gamemodefilter/OaGamemodeFilter.class b/modules/gamemode-voice-filter-module/target/classes/com/craftmend/gamemodefilter/OaGamemodeFilter.class
deleted file mode 100644
index eb8b6fe2f..000000000
Binary files a/modules/gamemode-voice-filter-module/target/classes/com/craftmend/gamemodefilter/OaGamemodeFilter.class and /dev/null differ
diff --git a/modules/gamemode-voice-filter-module/target/classes/type.info b/modules/gamemode-voice-filter-module/target/classes/type.info
deleted file mode 100644
index 10a135dc0..000000000
--- a/modules/gamemode-voice-filter-module/target/classes/type.info
+++ /dev/null
@@ -1 +0,0 @@
-main: com.craftmend.gamemodefilter.OaGamemodeFilter
\ No newline at end of file
diff --git a/modules/gamemode-voice-filter-module/target/maven-archiver/pom.properties b/modules/gamemode-voice-filter-module/target/maven-archiver/pom.properties
deleted file mode 100644
index c3cb31244..000000000
--- a/modules/gamemode-voice-filter-module/target/maven-archiver/pom.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-artifactId=openaudiomc-gamemodefilter
-groupId=com.craftmend.openaudiomc
-version=6.8.10
diff --git a/modules/gamemode-voice-filter-module/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/modules/gamemode-voice-filter-module/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
deleted file mode 100644
index 9ae938f3f..000000000
--- a/modules/gamemode-voice-filter-module/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
+++ /dev/null
@@ -1,2 +0,0 @@
-com/craftmend/gamemodefilter/OaGamemodeFilter.class
-com/craftmend/gamemodefilter/OaGamemodeFilter$1.class
diff --git a/modules/gamemode-voice-filter-module/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/modules/gamemode-voice-filter-module/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
deleted file mode 100644
index dbbcacd3c..000000000
--- a/modules/gamemode-voice-filter-module/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
+++ /dev/null
@@ -1 +0,0 @@
-/Users/mindgamesnl/workspaces/openaudiomc/OpenAudioMc/modules/gamemode-voice-filter-module/src/main/java/com/craftmend/gamemodefilter/OaGamemodeFilter.java
diff --git a/modules/mapdb-migrator/src/main/java/com/craftmend/oamapmigrator/database/models/Speaker.java b/modules/mapdb-migrator/src/main/java/com/craftmend/oamapmigrator/database/models/Speaker.java
index 71162db88..8c714fc5d 100644
--- a/modules/mapdb-migrator/src/main/java/com/craftmend/oamapmigrator/database/models/Speaker.java
+++ b/modules/mapdb-migrator/src/main/java/com/craftmend/oamapmigrator/database/models/Speaker.java
@@ -3,8 +3,8 @@
import com.craftmend.oamapmigrator.database.internal.LegacyStore;
import com.craftmend.openaudiomc.OpenAudioMc;
import com.craftmend.openaudiomc.spigot.modules.speakers.SpeakerService;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.ExtraSpeakerOptions;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.SpeakerType;
+import com.craftmend.openaudiomc.api.spakers.ExtraSpeakerOptions;
+import com.craftmend.openaudiomc.api.spakers.SpeakerType;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.MappedLocation;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.SpeakerMedia;
import lombok.Getter;
diff --git a/modules/parties-module/dependency-reduced-pom.xml b/modules/parties-module/dependency-reduced-pom.xml
new file mode 100644
index 000000000..ca9c7c8dd
--- /dev/null
+++ b/modules/parties-module/dependency-reduced-pom.xml
@@ -0,0 +1,135 @@
+
+
+
+ OpenAudioMc-Parent
+ com.craftmend.openaudiomc
+ 1.2
+ ../../pom.xml
+
+ 4.0.0
+ com.craftmend.openaudiomc
+ openaudiomc-parties
+ OpenAudioMc-parties
+ ${oa.version}
+
+
+
+ true
+ src/main/resources
+
+
+ parties-hook
+
+
+ maven-compiler-plugin
+ 3.8.1
+
+
+ ${java.version}
+
+
+
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+ de.tr7zw.changeme.nbtapi
+ com.craftmend.thirdparty.nbt
+
+
+ io.
+ com.craftmend.thirdparty.io
+
+
+ org.json.
+ com.craftmend.thirdparty.json
+
+
+ reactor.
+ com.craftmend.thirdparty.reactor
+
+
+ okhttp3
+ com.craftmend.thirdparty.okhttp3
+
+
+ okio
+ com.craftmend.thirdparty.okio
+
+
+ org.projectlombok
+ com.craftmend.thirdparty.org
+
+
+ org.mapdb
+ com.craftmend.thirdparty.mapdb
+
+
+ kotlin
+ com.craftmend.thirdparty.kotlin
+
+
+
+
+
+
+
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+
+ spigotmc-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+ sonatype
+ https://oss.sonatype.org/content/groups/public/
+
+
+ alessiodp-repo
+ https://repo.alessiodp.com/releases/
+
+
+
+
+ com.craftmend.openaudiomc
+ openaudiomc
+ 6.8.10
+ provided
+
+
+ com.alessiodp.parties
+ parties-api
+ 3.2.5
+ provided
+
+
+ org.spigotmc
+ spigot-api
+ 1.17.1-R0.1-SNAPSHOT
+ provided
+
+
+
+ 1.8
+ UTF-8
+
+
diff --git a/modules/rinaorc-legacy/dependency-reduced-pom.xml b/modules/rinaorc-legacy/dependency-reduced-pom.xml
new file mode 100644
index 000000000..88c7712dc
--- /dev/null
+++ b/modules/rinaorc-legacy/dependency-reduced-pom.xml
@@ -0,0 +1,128 @@
+
+
+
+ OpenAudioMc-Parent
+ com.craftmend.openaudiomc
+ 1.2
+ ../../pom.xml
+
+ 4.0.0
+ OpenAudioMc-rinaorc-legacy
+ OpenAudioMc-rinaorc-legacy
+ ${oa.version}
+
+
+
+ true
+ src/main/resources
+
+
+ rinaorc-legacy-users
+
+
+ maven-compiler-plugin
+ 3.8.1
+
+
+ ${java.version}
+
+
+
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+ de.tr7zw.changeme.nbtapi
+ com.craftmend.thirdparty.nbt
+
+
+ io.
+ com.craftmend.thirdparty.io
+
+
+ org.json.
+ com.craftmend.thirdparty.json
+
+
+ reactor.
+ com.craftmend.thirdparty.reactor
+
+
+ okhttp3
+ com.craftmend.thirdparty.okhttp3
+
+
+ okio
+ com.craftmend.thirdparty.okio
+
+
+ org.projectlombok
+ com.craftmend.thirdparty.org
+
+
+ org.mapdb
+ com.craftmend.thirdparty.mapdb
+
+
+ kotlin
+ com.craftmend.thirdparty.kotlin
+
+
+
+
+
+
+
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+
+ spigotmc-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+ sonatype
+ https://oss.sonatype.org/content/groups/public/
+
+
+ alessiodp-repo
+ https://repo.alessiodp.com/releases/
+
+
+
+
+ com.craftmend.openaudiomc
+ openaudiomc
+ 6.8.10
+ provided
+
+
+ org.spigotmc
+ spigot-api
+ 1.8.8-R0.1-SNAPSHOT
+ provided
+
+
+
+ 1.8
+ UTF-8
+
+
diff --git a/modules/skywars-module/dependency-reduced-pom.xml b/modules/skywars-module/dependency-reduced-pom.xml
new file mode 100644
index 000000000..d654fb61f
--- /dev/null
+++ b/modules/skywars-module/dependency-reduced-pom.xml
@@ -0,0 +1,135 @@
+
+
+
+ OpenAudioMc-Parent
+ com.craftmend.openaudiomc
+ 1.2
+ ../../pom.xml
+
+ 4.0.0
+ com.craftmend.openaudiomc
+ openaudiomc-skywars
+ OpenAudioMc-skywars
+ ${oa.version}
+
+
+
+ true
+ src/main/resources
+
+
+ skywars-hook
+
+
+ maven-compiler-plugin
+ 3.8.1
+
+
+ ${java.version}
+
+
+
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+ de.tr7zw.changeme.nbtapi
+ com.craftmend.thirdparty.nbt
+
+
+ io.
+ com.craftmend.thirdparty.io
+
+
+ org.json.
+ com.craftmend.thirdparty.json
+
+
+ reactor.
+ com.craftmend.thirdparty.reactor
+
+
+ okhttp3
+ com.craftmend.thirdparty.okhttp3
+
+
+ okio
+ com.craftmend.thirdparty.okio
+
+
+ org.projectlombok
+ com.craftmend.thirdparty.org
+
+
+ org.mapdb
+ com.craftmend.thirdparty.mapdb
+
+
+ kotlin
+ com.craftmend.thirdparty.kotlin
+
+
+
+
+
+
+
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+
+ spigotmc-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+ sonatype
+ https://oss.sonatype.org/content/groups/public/
+
+
+ gcnt
+ https://nexuslite.gcnt.net/repos/gcnt
+
+
+
+
+ com.craftmend.openaudiomc
+ openaudiomc
+ 6.8.10
+ provided
+
+
+ net.gcnt
+ skywarsreloaded
+ 5.6.1
+ provided
+
+
+ org.spigotmc
+ spigot-api
+ 1.17.1-R0.1-SNAPSHOT
+ provided
+
+
+
+ 1.8
+ UTF-8
+
+
diff --git a/modules/survival-audio-rules-module/target/classes/com/craftmend/rules/survival/OaSurvivalRules.class b/modules/survival-audio-rules-module/target/classes/com/craftmend/rules/survival/OaSurvivalRules.class
deleted file mode 100644
index 8904a20c2..000000000
Binary files a/modules/survival-audio-rules-module/target/classes/com/craftmend/rules/survival/OaSurvivalRules.class and /dev/null differ
diff --git a/modules/survival-audio-rules-module/target/classes/type.info b/modules/survival-audio-rules-module/target/classes/type.info
deleted file mode 100644
index d6cdf82fc..000000000
--- a/modules/survival-audio-rules-module/target/classes/type.info
+++ /dev/null
@@ -1 +0,0 @@
-main: com.craftmend.oaparties.RinoarcLegacy
\ No newline at end of file
diff --git a/modules/survival-audio-rules-module/target/maven-archiver/pom.properties b/modules/survival-audio-rules-module/target/maven-archiver/pom.properties
deleted file mode 100644
index b09654622..000000000
--- a/modules/survival-audio-rules-module/target/maven-archiver/pom.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-artifactId=openaudiomc-survival-audio-rules
-groupId=com.craftmend.openaudiomc
-version=6.8.10
diff --git a/modules/survival-audio-rules-module/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/modules/survival-audio-rules-module/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
deleted file mode 100644
index 678359cd7..000000000
--- a/modules/survival-audio-rules-module/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
+++ /dev/null
@@ -1 +0,0 @@
-com/craftmend/rules/survival/OaSurvivalRules.class
diff --git a/modules/survival-audio-rules-module/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/modules/survival-audio-rules-module/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
deleted file mode 100644
index 99df6c87f..000000000
--- a/modules/survival-audio-rules-module/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
+++ /dev/null
@@ -1 +0,0 @@
-/Users/mindgamesnl/workspaces/openaudiomc/OpenAudioMc/modules/survival-audio-rules-module/src/main/java/com/craftmend/rules/survival/OaSurvivalRules.java
diff --git a/modules/voice-join-permission/dependency-reduced-pom.xml b/modules/voice-join-permission/dependency-reduced-pom.xml
new file mode 100644
index 000000000..37afbca9b
--- /dev/null
+++ b/modules/voice-join-permission/dependency-reduced-pom.xml
@@ -0,0 +1,125 @@
+
+
+
+ OpenAudioMc-Parent
+ com.craftmend.openaudiomc
+ 1.2
+ ../../pom.xml
+
+ 4.0.0
+ com.craftmend
+ openaudiomc-voice-permission
+ OpenAudioMc-voice-permissions
+ ${oa.version}
+
+
+
+ true
+ src/main/resources
+
+
+ voice-join-permission
+
+
+ maven-compiler-plugin
+ 3.8.1
+
+
+ ${java.version}
+
+
+
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+ de.tr7zw.changeme.nbtapi
+ com.craftmend.thirdparty.nbt
+
+
+ io.
+ com.craftmend.thirdparty.io
+
+
+ org.json.
+ com.craftmend.thirdparty.json
+
+
+ reactor.
+ com.craftmend.thirdparty.reactor
+
+
+ okhttp3
+ com.craftmend.thirdparty.okhttp3
+
+
+ okio
+ com.craftmend.thirdparty.okio
+
+
+ org.projectlombok
+ com.craftmend.thirdparty.org
+
+
+ org.mapdb
+ com.craftmend.thirdparty.mapdb
+
+
+ kotlin
+ com.craftmend.thirdparty.kotlin
+
+
+
+
+
+
+
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+
+ spigotmc-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+ sonatype
+ https://oss.sonatype.org/content/groups/public/
+
+
+
+
+ com.craftmend.openaudiomc
+ openaudiomc
+ 6.8.10
+ provided
+
+
+ org.spigotmc
+ spigot-api
+ 1.17.1-R0.1-SNAPSHOT
+ provided
+
+
+
+ 1.8
+ UTF-8
+
+
diff --git a/plugin/pom.xml b/plugin/pom.xml
index e6cdb3e55..9fc607086 100644
--- a/plugin/pom.xml
+++ b/plugin/pom.xml
@@ -101,6 +101,11 @@
+
+ com.craftmend.openaudiomc
+ openaudiomc-api
+ 6.8.10
+
com.coreoz
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/OpenAudioMc.java b/plugin/src/main/java/com/craftmend/openaudiomc/OpenAudioMc.java
index e803a1b07..59e94bfd8 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/OpenAudioMc.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/OpenAudioMc.java
@@ -2,6 +2,7 @@
import com.craftmend.openaudiomc.api.enums.ModuleEvent;
import com.craftmend.openaudiomc.api.impl.event.ApiEventDriver;
+import com.craftmend.openaudiomc.generic.api.ApiService;
import com.craftmend.openaudiomc.generic.authentication.AuthenticationService;
import com.craftmend.openaudiomc.generic.backups.BackupService;
import com.craftmend.openaudiomc.generic.client.ClientDataService;
@@ -149,7 +150,8 @@ public OpenAudioMc(OpenAudioInvoker invoker) throws Exception {
RedisService.class, // redis hook/service implementation
OpenaudioAccountService.class, // platform specific features, like voice chat
RestDirectService.class, // manage rest direct
- ClientDataService.class // manage player profiles
+ ClientDataService.class, // manage player profiles
+ ApiService.class // initialize api implementations
);
getService(ModuleLoaderService.class).fire(ModuleEvent.SERVICES_LOADED);
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/MediaApiImpl.java b/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/MediaApiImpl.java
index 26673ee0d..f6866c362 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/MediaApiImpl.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/MediaApiImpl.java
@@ -3,8 +3,8 @@
import com.craftmend.openaudiomc.OpenAudioMc;
import com.craftmend.openaudiomc.api.interfaces.Client;
import com.craftmend.openaudiomc.api.interfaces.MediaApi;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
-import com.craftmend.openaudiomc.generic.media.objects.MediaOptions;
+import com.craftmend.openaudiomc.api.media.Media;
+import com.craftmend.openaudiomc.api.media.MediaOptions;
import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
import com.craftmend.openaudiomc.generic.networking.packets.client.media.PacketClientDestroyMedia;
@@ -14,7 +14,7 @@
import com.craftmend.openaudiomc.generic.networking.payloads.client.speakers.ClientSpeakerDestroyPayload;
import com.craftmend.openaudiomc.generic.networking.payloads.client.speakers.objects.ClientSpeaker;
import com.craftmend.openaudiomc.spigot.services.world.Vector3;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.SpeakerType;
+import com.craftmend.openaudiomc.api.spakers.SpeakerType;
import java.time.Instant;
import java.util.UUID;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/RegistryApiImpl.java b/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/RegistryApiImpl.java
index 976c71699..d6334623e 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/RegistryApiImpl.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/RegistryApiImpl.java
@@ -9,7 +9,7 @@
import com.craftmend.openaudiomc.generic.commands.interfaces.SubCommand;
import com.craftmend.openaudiomc.generic.database.DatabaseService;
import com.craftmend.openaudiomc.generic.media.MediaService;
-import com.craftmend.openaudiomc.generic.media.interfaces.UrlMutation;
+import com.craftmend.openaudiomc.api.media.UrlMutation;
import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
import com.craftmend.openaudiomc.generic.platform.Platform;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/event/enums/VoiceEventCause.java b/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/event/enums/VoiceEventCause.java
deleted file mode 100644
index d1b209c18..000000000
--- a/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/event/enums/VoiceEventCause.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.craftmend.openaudiomc.api.impl.event.enums;
-
-/**
- * This enum represents the cause of a specific event, used to provide more context
- * or filter based on functionality.
- *
- * Example: the {@link com.craftmend.openaudiomc.api.impl.event.events.PlayerEnterVoiceProximityEvent} can be called for a few reasons,
- * like walking up to some one or shouting from a distance; and you may not want to execute the same behaviour
- * for both scenarios
- */
-public enum VoiceEventCause {
-
- // voice state changed under normal circumstances
- NORMAL,
- // voice change was due to shouting
- SHOUT
-
-}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/event/events/PlayerEnterVoiceProximityEvent.java b/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/event/events/PlayerEnterVoiceProximityEvent.java
index aa3b9aa5c..f34e85b13 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/event/events/PlayerEnterVoiceProximityEvent.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/event/events/PlayerEnterVoiceProximityEvent.java
@@ -2,7 +2,6 @@
import com.craftmend.openaudiomc.api.impl.event.AudioEvent;
import com.craftmend.openaudiomc.api.impl.event.enums.EventSupport;
-import com.craftmend.openaudiomc.api.impl.event.enums.VoiceEventCause;
import com.craftmend.openaudiomc.api.interfaces.EventSupportFlag;
import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
import lombok.AllArgsConstructor;
@@ -26,6 +25,5 @@ public class PlayerEnterVoiceProximityEvent extends AudioEvent {
private ClientConnection speaker;
private ClientConnection listener;
- private VoiceEventCause cause;
}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/event/events/PlayerLeaveVoiceProximityEvent.java b/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/event/events/PlayerLeaveVoiceProximityEvent.java
index 6a152a8a6..5d55bd615 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/event/events/PlayerLeaveVoiceProximityEvent.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/api/impl/event/events/PlayerLeaveVoiceProximityEvent.java
@@ -2,7 +2,6 @@
import com.craftmend.openaudiomc.api.impl.event.AudioEvent;
import com.craftmend.openaudiomc.api.impl.event.enums.EventSupport;
-import com.craftmend.openaudiomc.api.impl.event.enums.VoiceEventCause;
import com.craftmend.openaudiomc.api.interfaces.EventSupportFlag;
import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
import lombok.AllArgsConstructor;
@@ -26,6 +25,5 @@ public class PlayerLeaveVoiceProximityEvent extends AudioEvent {
private ClientConnection speaker;
private ClientConnection listener;
- private VoiceEventCause cause;
}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/api/interfaces/Client.java b/plugin/src/main/java/com/craftmend/openaudiomc/api/interfaces/Client.java
index 783e5d2fc..c548078b1 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/api/interfaces/Client.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/api/interfaces/Client.java
@@ -1,9 +1,9 @@
package com.craftmend.openaudiomc.api.interfaces;
-import com.craftmend.openaudiomc.generic.client.objects.VoicePeerOptions;
import com.craftmend.openaudiomc.generic.media.objects.Media;
import com.craftmend.openaudiomc.generic.user.User;
+@Deprecated
public interface Client {
/**
@@ -66,6 +66,4 @@ public interface Client {
*/
void preloadMedia(String source);
- void updatePeerOptions(Client peer, VoicePeerOptions options);
-
}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/api/interfaces/MediaApi.java b/plugin/src/main/java/com/craftmend/openaudiomc/api/interfaces/MediaApi.java
index 8324cdcce..4ff5ea7a4 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/api/interfaces/MediaApi.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/api/interfaces/MediaApi.java
@@ -1,6 +1,6 @@
package com.craftmend.openaudiomc.api.interfaces;
-import com.craftmend.openaudiomc.generic.media.objects.MediaOptions;
+import com.craftmend.openaudiomc.api.media.MediaOptions;
public interface MediaApi {
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/api/interfaces/RegistryApi.java b/plugin/src/main/java/com/craftmend/openaudiomc/api/interfaces/RegistryApi.java
index fb39ba3c3..0da9f8cb2 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/api/interfaces/RegistryApi.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/api/interfaces/RegistryApi.java
@@ -2,7 +2,7 @@
import com.craftmend.openaudiomc.api.exceptions.RegionException;
import com.craftmend.openaudiomc.generic.commands.interfaces.SubCommand;
-import com.craftmend.openaudiomc.generic.media.interfaces.UrlMutation;
+import com.craftmend.openaudiomc.api.media.UrlMutation;
import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
import com.craftmend.openaudiomc.generic.utils.data.Filter;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/ApiService.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/ApiService.java
new file mode 100644
index 000000000..9fa320bfd
--- /dev/null
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/ApiService.java
@@ -0,0 +1,27 @@
+package com.craftmend.openaudiomc.generic.api;
+
+import com.craftmend.openaudiomc.api.ApiHolder;
+import com.craftmend.openaudiomc.generic.api.implementaions.ClientApiImpl;
+import com.craftmend.openaudiomc.generic.api.implementaions.MediaApiImpl;
+import com.craftmend.openaudiomc.generic.api.implementaions.VoiceApiImpl;
+import com.craftmend.openaudiomc.generic.api.implementaions.WorldApiImpl;
+import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
+import com.craftmend.openaudiomc.generic.service.Inject;
+import com.craftmend.openaudiomc.generic.service.Service;
+
+public class ApiService extends Service {
+
+ @Inject
+ public ApiService(
+ NetworkingService networkingService
+ ) {
+ // initialize api
+ ApiHolder.initiate(
+ new ClientApiImpl(networkingService),
+ new WorldApiImpl(),
+ new VoiceApiImpl(),
+ new MediaApiImpl()
+ );
+ }
+
+}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/implementaions/ClientApiImpl.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/implementaions/ClientApiImpl.java
new file mode 100644
index 000000000..2505b8b05
--- /dev/null
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/implementaions/ClientApiImpl.java
@@ -0,0 +1,36 @@
+package com.craftmend.openaudiomc.generic.api.implementaions;
+
+import com.craftmend.openaudiomc.api.ClientApi;
+import com.craftmend.openaudiomc.api.clients.Client;
+import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
+import lombok.AllArgsConstructor;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.UUID;
+
+@AllArgsConstructor
+public class ClientApiImpl implements ClientApi {
+
+ private NetworkingService networkingService;
+
+ @Nullable
+ @Override
+ public Client getClient(UUID clientUuid) {
+ return networkingService.getClient(clientUuid);
+ }
+
+ @NotNull
+ @Override
+ public Collection getAllClients() {
+ return new ArrayList<>(networkingService.getClients());
+ }
+
+ @Override
+ public boolean isConnected(UUID uuid) {
+ Client c = getClient(uuid);
+ return c != null && c.isConnected();
+ }
+}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/implementaions/MediaApiImpl.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/implementaions/MediaApiImpl.java
new file mode 100644
index 000000000..df856ce1f
--- /dev/null
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/implementaions/MediaApiImpl.java
@@ -0,0 +1,60 @@
+package com.craftmend.openaudiomc.generic.api.implementaions;
+
+import com.craftmend.openaudiomc.OpenAudioMc;
+import com.craftmend.openaudiomc.api.MediaApi;
+import com.craftmend.openaudiomc.api.clients.Client;
+import com.craftmend.openaudiomc.api.media.Media;
+import com.craftmend.openaudiomc.api.media.UrlMutation;
+import com.craftmend.openaudiomc.generic.media.MediaService;
+import com.craftmend.openaudiomc.generic.media.time.TimeService;
+import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
+import com.craftmend.openaudiomc.generic.networking.packets.client.media.PacketClientDestroyMedia;
+import org.jetbrains.annotations.NotNull;
+
+import static com.craftmend.openaudiomc.generic.api.utils.ApiUtils.validateClient;
+
+public class MediaApiImpl implements MediaApi {
+
+ @NotNull
+ @Override
+ public Media createMedia(@NotNull String source) {
+ return new Media(source);
+ }
+
+ @NotNull
+ @Override
+ public String translateSource(@NotNull String source) {
+ return OpenAudioMc.getService(MediaService.class).process(source);
+ }
+
+ @Override
+ public void registerMutation(@NotNull String prefix, @NotNull UrlMutation mutation) {
+ OpenAudioMc.getService(MediaService.class).registerMutation(prefix, mutation);
+ }
+
+ @Override
+ public long getNormalizedCurrentEpoch() {
+ return OpenAudioMc.getService(TimeService.class).getSyncedInstant().toEpochMilli();
+ }
+
+ @Override
+ public void playFor(@NotNull Media media, @NotNull Client... clients) {
+ for (Client client : clients) {
+ client.playMedia(media);
+ }
+ }
+
+ @Override
+ public void stopFor(@NotNull Client... clients) {
+ for (Client client : clients) {
+ OpenAudioMc.getService(NetworkingService.class).send(validateClient(client), new PacketClientDestroyMedia(null));
+ }
+ }
+
+ @Override
+ public void stopFor(@NotNull String id, @NotNull Client... clients) {
+ for (Client client : clients) {
+ OpenAudioMc.getService(NetworkingService.class).send(validateClient(client), new PacketClientDestroyMedia(id));
+ }
+ }
+}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/implementaions/VoiceApiImpl.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/implementaions/VoiceApiImpl.java
new file mode 100644
index 000000000..ee2619734
--- /dev/null
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/implementaions/VoiceApiImpl.java
@@ -0,0 +1,124 @@
+package com.craftmend.openaudiomc.generic.api.implementaions;
+
+import com.craftmend.openaudiomc.OpenAudioMc;
+import com.craftmend.openaudiomc.api.VoiceApi;
+import com.craftmend.openaudiomc.api.clients.Client;
+import com.craftmend.openaudiomc.api.voice.VoicePeerOptions;
+import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
+import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
+import com.craftmend.openaudiomc.generic.networking.packets.client.voice.PacketClientVoiceOptionsUpdate;
+import com.craftmend.openaudiomc.generic.networking.payloads.client.voice.ClientVoiceOptionsPayload;
+import com.craftmend.openaudiomc.generic.platform.Platform;
+
+import java.util.Objects;
+import java.util.UUID;
+
+public class VoiceApiImpl implements VoiceApi {
+
+ @Override
+ public boolean hasPeer(Client haystack, Client needle) {
+ if (OpenAudioMc.getInstance().getPlatform() != Platform.SPIGOT) {
+ throw new IllegalStateException("This method is only available on the spigot platform");
+ }
+
+ return hasPeer(haystack, needle.getActor().getUniqueId());
+ }
+
+ @Override
+ public boolean hasPeer(Client haystack, UUID needle) {
+ if (OpenAudioMc.getInstance().getPlatform() != Platform.SPIGOT) {
+ throw new IllegalStateException("This method is only available on the spigot platform");
+ }
+
+ ClientConnection clientConnection = (ClientConnection) haystack;
+ return clientConnection.getRtcSessionManager().isPeer(needle);
+ }
+
+ @Override
+ public void updatePeerOptions(Client client, Client peerToUpdate, VoicePeerOptions options) {
+ if (OpenAudioMc.getInstance().getPlatform() != Platform.SPIGOT) {
+ throw new IllegalStateException("This method is only available on the spigot platform");
+ }
+
+ Objects.requireNonNull(peerToUpdate, "Peer cannot be null");
+ Objects.requireNonNull(options, "Options cannot be null");
+
+ ClientConnection clientConnection = (ClientConnection) client;
+ ClientConnection peerConnection = (ClientConnection) peerToUpdate;
+
+ // do we have this peer?
+ if (!clientConnection.getRtcSessionManager().isPeer(peerConnection.getActor().getUniqueId())) {
+ throw new IllegalArgumentException("Peer is not connected to this client");
+ }
+
+ // update the options
+ ClientConnection peerCon = OpenAudioMc.getService(NetworkingService.class).getClient(peerConnection.getUser().getUniqueId());
+ PacketClientVoiceOptionsUpdate packet = new PacketClientVoiceOptionsUpdate(
+ new ClientVoiceOptionsPayload(peerCon.getRtcSessionManager().getStreamKey(), options)
+ );
+ clientConnection.sendPacket(packet);
+ }
+
+ private boolean isProximityPeer(Client haystack, Client needle) {
+ if (OpenAudioMc.getInstance().getPlatform() != Platform.SPIGOT) {
+ throw new IllegalStateException("This method is only available on the spigot platform");
+ }
+
+ ClientConnection haystackConnection = (ClientConnection) haystack;
+ return haystackConnection.getRtcSessionManager().getCurrentProximityPeers().contains(needle.getActor().getUniqueId());
+ }
+
+ public boolean isGlobalPeer(Client haystack, Client needle) {
+ ClientConnection haystackConnection = (ClientConnection) haystack;
+ return haystackConnection.getRtcSessionManager().getCurrentGlobalPeers().contains(needle.getActor().getUniqueId());
+ }
+
+ @Override
+ public void addStaticPeer(Client client, Client peerToAdd, boolean visible, boolean mutual) {
+ if (OpenAudioMc.getInstance().getPlatform() != Platform.SPIGOT) {
+ throw new IllegalStateException("This method is only available on the spigot platform");
+ }
+
+ VoicePeerOptions options = new VoicePeerOptions();
+ options.setSpatialAudio(false);
+ options.setVisible(visible);
+
+ ClientConnection clientConnection = (ClientConnection) client;
+ ClientConnection peerConnection = (ClientConnection) peerToAdd;
+
+ if (!clientConnection.getRtcSessionManager().isReady() || !peerConnection.getRtcSessionManager().isReady()) {
+ throw new IllegalStateException("Both clients must be ready (connected and have voice chat enabled) before adding a peer");
+ }
+
+ if (isProximityPeer(client, peerToAdd)) {
+ updatePeerOptions(client, peerToAdd, options);
+ clientConnection.getRtcSessionManager().getCurrentGlobalPeers().add(peerToAdd.getActor().getUniqueId());
+ clientConnection.getRtcSessionManager().getCurrentProximityPeers().remove(peerToAdd.getActor().getUniqueId());
+ } else {
+ clientConnection.getRtcSessionManager().getCurrentGlobalPeers().add(peerToAdd.getActor().getUniqueId());
+ clientConnection.getPeerQueue().addSubscribe(peerConnection, clientConnection, options);
+ }
+
+ if (mutual) {
+ addStaticPeer(peerToAdd, client, visible, false);
+ }
+ }
+
+ @Override
+ public void removeStaticPeer(Client client, Client peerToRemove, boolean mutual) {
+ if (OpenAudioMc.getInstance().getPlatform() != Platform.SPIGOT) {
+ throw new IllegalStateException("This method is only available on the spigot platform");
+ }
+
+ if (isGlobalPeer(client, peerToRemove)) {
+ ClientConnection clientConnection = (ClientConnection) client;
+ ClientConnection peerConnection = (ClientConnection) peerToRemove;
+ clientConnection.getRtcSessionManager().getCurrentGlobalPeers().remove(peerToRemove.getActor().getUniqueId());
+ clientConnection.getPeerQueue().drop(peerConnection.getRtcSessionManager().getStreamKey());
+ }
+
+ if (mutual) {
+ removeStaticPeer(peerToRemove, client, false);
+ }
+ }
+}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/implementaions/WorldApiImpl.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/implementaions/WorldApiImpl.java
new file mode 100644
index 000000000..2cb05123a
--- /dev/null
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/implementaions/WorldApiImpl.java
@@ -0,0 +1,89 @@
+package com.craftmend.openaudiomc.generic.api.implementaions;
+
+import com.craftmend.openaudiomc.OpenAudioMc;
+import com.craftmend.openaudiomc.api.WorldApi;
+import com.craftmend.openaudiomc.api.media.Media;
+import com.craftmend.openaudiomc.api.regions.AudioRegion;
+import com.craftmend.openaudiomc.api.spakers.BasicSpeaker;
+import com.craftmend.openaudiomc.generic.platform.Platform;
+import com.craftmend.openaudiomc.spigot.OpenAudioMcSpigot;
+import com.craftmend.openaudiomc.spigot.modules.regions.RegionModule;
+import com.craftmend.openaudiomc.spigot.modules.regions.interfaces.ApiRegion;
+import com.craftmend.openaudiomc.spigot.modules.regions.objects.RegionProperties;
+import com.craftmend.openaudiomc.spigot.modules.speakers.SpeakerService;
+import com.craftmend.openaudiomc.spigot.modules.speakers.objects.MappedLocation;
+import lombok.AllArgsConstructor;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class WorldApiImpl implements WorldApi {
+
+ @NotNull
+ @Override
+ public Collection getRegionsAt(int x, int y, int z, @NotNull String world) {
+ if (OpenAudioMc.getInstance().getPlatform() != Platform.SPIGOT) {
+ throw new IllegalStateException("This method is only available on the spigot platform");
+ }
+
+ RegionModule regionModule = OpenAudioMcSpigot.getInstance().getRegionModule();
+
+ List regions = new ArrayList<>();
+
+ for (ApiRegion apiRegion : regionModule.getRegionAdapter().getRegionsAtLocation(
+ new Location(Bukkit.getWorld(world), x, y, z)
+ )) {
+ RegionProperties rp = regionModule.getWorld(world).getRegionProperties(apiRegion.getName());
+ regions.add(new WrappedRegion(apiRegion, world, rp.getMediaForWorld(world)));
+ }
+
+ return regions;
+ }
+
+ @Nullable
+ @Override
+ public BasicSpeaker getSpeakerAt(int x, int y, int z, @NotNull String world) {
+ if (OpenAudioMc.getInstance().getPlatform() != Platform.SPIGOT) {
+ throw new IllegalStateException("This method is only available on the spigot platform");
+ }
+
+ return OpenAudioMc.getService(SpeakerService.class).getSpeaker(new MappedLocation(x, y, z, world));
+ }
+
+ @AllArgsConstructor
+ private static class WrappedRegion implements AudioRegion {
+
+ private ApiRegion region;
+ private String world;
+ private Media media;
+
+ @NotNull
+ @Override
+ public Media getMedia() {
+ return media;
+ }
+
+ @NotNull
+ @Override
+ public String getRegionId() {
+ return region.getName();
+ }
+
+ @Nullable
+ @Override
+ public String getWorld() {
+ return world;
+ }
+
+ @Override
+ public int getPriority() {
+ return region.getPriority();
+ }
+ }
+
+}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/utils/ApiUtils.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/utils/ApiUtils.java
new file mode 100644
index 000000000..547ec9f7a
--- /dev/null
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/api/utils/ApiUtils.java
@@ -0,0 +1,13 @@
+package com.craftmend.openaudiomc.generic.api.utils;
+
+import com.craftmend.openaudiomc.api.clients.Client;
+import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
+
+public class ApiUtils {
+
+ public static ClientConnection validateClient(Client client) {
+ if (!(client instanceof ClientConnection)) throw new IllegalStateException("This player isn't a instance of ClientConnection");
+ return (ClientConnection) client;
+ }
+
+}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/enums/RtcBlockReason.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/enums/RtcBlockReason.java
index d0b81d28e..9bd744fb4 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/enums/RtcBlockReason.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/enums/RtcBlockReason.java
@@ -2,6 +2,7 @@
public enum RtcBlockReason {
- IN_DISABLED_REGION
+ IN_DISABLED_REGION,
+ EXEMPTED_FROM_PEER_TICKING
}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/objects/ClientConnection.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/objects/ClientConnection.java
index d435a88b2..e85649ccd 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/objects/ClientConnection.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/objects/ClientConnection.java
@@ -1,68 +1,73 @@
package com.craftmend.openaudiomc.generic.client.objects;
import com.craftmend.openaudiomc.OpenAudioMc;
-
+import com.craftmend.openaudiomc.api.basic.Actor;
+import com.craftmend.openaudiomc.api.clients.Client;
import com.craftmend.openaudiomc.api.impl.event.events.ClientConnectEvent;
import com.craftmend.openaudiomc.api.impl.event.events.ClientDisconnectEvent;
import com.craftmend.openaudiomc.api.impl.event.events.ClientErrorEvent;
import com.craftmend.openaudiomc.api.interfaces.AudioApi;
-import com.craftmend.openaudiomc.api.interfaces.Client;
-
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.client.ClientDataService;
+import com.craftmend.openaudiomc.generic.client.helpers.SerializableClient;
+import com.craftmend.openaudiomc.generic.client.helpers.TokenFactory;
+import com.craftmend.openaudiomc.generic.client.session.ClientAuth;
+import com.craftmend.openaudiomc.generic.client.session.RtcSessionManager;
+import com.craftmend.openaudiomc.generic.client.session.SessionData;
import com.craftmend.openaudiomc.generic.client.store.ClientDataStore;
import com.craftmend.openaudiomc.generic.environment.GlobalConstantService;
import com.craftmend.openaudiomc.generic.environment.MagicValue;
import com.craftmend.openaudiomc.generic.media.MediaService;
import com.craftmend.openaudiomc.generic.networking.abstracts.AbstractPacket;
-import com.craftmend.openaudiomc.generic.client.session.ClientAuth;
-import com.craftmend.openaudiomc.generic.client.session.RtcSessionManager;
-import com.craftmend.openaudiomc.generic.client.helpers.SerializableClient;
-import com.craftmend.openaudiomc.generic.client.session.SessionData;
-import com.craftmend.openaudiomc.generic.client.helpers.TokenFactory;
import com.craftmend.openaudiomc.generic.networking.enums.MediaError;
import com.craftmend.openaudiomc.generic.networking.interfaces.Authenticatable;
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
+import com.craftmend.openaudiomc.generic.networking.packets.PacketSocketKickClient;
import com.craftmend.openaudiomc.generic.networking.packets.client.media.PacketClientCreateMedia;
import com.craftmend.openaudiomc.generic.networking.packets.client.media.PacketClientPreFetch;
import com.craftmend.openaudiomc.generic.networking.packets.client.ui.PacketClientModerationStatus;
import com.craftmend.openaudiomc.generic.networking.packets.client.ui.PacketClientProtocolRevisionPacket;
import com.craftmend.openaudiomc.generic.networking.packets.client.ui.PacketClientSetVolume;
-import com.craftmend.openaudiomc.generic.networking.packets.client.voice.PacketClientVoiceOptionsUpdate;
import com.craftmend.openaudiomc.generic.networking.payloads.client.media.ClientPreFetchPayload;
-import com.craftmend.openaudiomc.generic.networking.payloads.client.voice.ClientVoiceOptionsPayload;
-import com.craftmend.openaudiomc.generic.rest.Task;
import com.craftmend.openaudiomc.generic.node.packets.ClientConnectedPacket;
import com.craftmend.openaudiomc.generic.node.packets.ClientDisconnectedPacket;
+import com.craftmend.openaudiomc.generic.platform.Platform;
import com.craftmend.openaudiomc.generic.platform.interfaces.TaskService;
import com.craftmend.openaudiomc.generic.proxy.interfaces.UserHooks;
-import com.craftmend.openaudiomc.generic.user.User;
+import com.craftmend.openaudiomc.generic.rest.Task;
import com.craftmend.openaudiomc.generic.storage.enums.StorageKey;
import com.craftmend.openaudiomc.generic.storage.interfaces.Configuration;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
-import com.craftmend.openaudiomc.generic.networking.packets.*;
-import com.craftmend.openaudiomc.generic.platform.Platform;
-
+import com.craftmend.openaudiomc.generic.user.User;
import com.craftmend.openaudiomc.spigot.OpenAudioMcSpigot;
import com.craftmend.openaudiomc.spigot.modules.proxy.enums.OAClientMode;
-
import lombok.Getter;
import lombok.Setter;
+import org.jetbrains.annotations.NotNull;
import java.io.Serializable;
import java.time.Instant;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
-public class ClientConnection implements Authenticatable, Client, Serializable {
+public class ClientConnection implements Authenticatable, Client, Serializable,
+ com.craftmend.openaudiomc.api.interfaces.Client {
- @Getter private transient final User> user;
+ @Getter
+ private transient final User> user;
- @Getter private final SessionData session;
- @Setter private ClientAuth auth;
- @Getter private final RtcSessionManager rtcSessionManager;
+ @Getter
+ private final SessionData session;
+ @Setter
+ private ClientAuth auth;
+ @Getter
+ private final RtcSessionManager rtcSessionManager;
private transient final List connectHandlers = new ArrayList<>();
private transient final List disconnectHandlers = new ArrayList<>();
- @Setter @Getter private ClientDataStore dataCache;
- @Getter private PeerQueue peerQueue = new PeerQueue();
+ @Setter
+ @Getter
+ private ClientDataStore dataCache;
+ @Getter
+ private PeerQueue peerQueue = new PeerQueue();
public ClientConnection(User playerContainer, SerializableClient fromSerialized) {
this.user = playerContainer;
@@ -207,12 +212,6 @@ public void setModerating(boolean state) {
}
}
- /**
- * send media to the client to play
- *
- * @param media media to be send
- */
- @Override
public void sendMedia(Media media) {
if (media.getKeepTimeout() != -1 && !session.getOngoingMedia().contains(media)) {
session.getOngoingMedia().add(media);
@@ -259,16 +258,36 @@ public void handleError(MediaError error, String source) {
}
}
+ @Override
+ public Actor getActor() {
+ return getOwner();
+ }
+
@Override
public boolean isConnected() {
return this.session.isConnected();
}
+ @Override
+ public boolean hasVoicechatEnabled() {
+ return false;
+ }
+
+ @Override
+ public boolean isMicrophoneMuted() {
+ return false;
+ }
+
@Override
public void onConnect(Runnable runnable) {
addOnConnectHandler(runnable);
}
+ @Override
+ public void sendMedia(com.craftmend.openaudiomc.generic.media.objects.Media media) {
+ sendMedia(media);
+ }
+
@Override
public void onDisconnect(Runnable runnable) {
addOnDisconnectHandler(runnable);
@@ -294,27 +313,15 @@ public boolean isModerating() {
return session.isModerating();
}
+ @Override
+ public void playMedia(@NotNull Media media) {
+ sendMedia(media);
+ }
+
@Override
public void preloadMedia(String source) {
ClientPreFetchPayload payload = new ClientPreFetchPayload(OpenAudioMc.getService(MediaService.class).process(source), "api", false);
sendPacket(new PacketClientPreFetch(payload));
}
- @Override
- public void updatePeerOptions(Client peer, VoicePeerOptions options) {
- Objects.requireNonNull(peer, "Peer cannot be null");
- Objects.requireNonNull(options, "Options cannot be null");
-
- // do we have this peer?
- if (!rtcSessionManager.isPeer(peer.getUser().getUniqueId())) {
- throw new IllegalArgumentException("Peer is not connected to this client");
- }
-
- // update the options
- ClientConnection peerCon = OpenAudioMc.getService(NetworkingService.class).getClient(peer.getUser().getUniqueId());
- PacketClientVoiceOptionsUpdate packet = new PacketClientVoiceOptionsUpdate(
- new ClientVoiceOptionsPayload(peerCon.getRtcSessionManager().getStreamKey(), options)
- );
- sendPacket(packet);
- }
}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/objects/PeerQueue.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/objects/PeerQueue.java
index 49d955545..c764bee8e 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/objects/PeerQueue.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/objects/PeerQueue.java
@@ -1,5 +1,6 @@
package com.craftmend.openaudiomc.generic.client.objects;
+import com.craftmend.openaudiomc.api.voice.VoicePeerOptions;
import com.craftmend.openaudiomc.generic.networking.packets.client.voice.PacketClientDropVoiceStream;
import com.craftmend.openaudiomc.generic.networking.packets.client.voice.PacketClientSubscribeToVoice;
import com.craftmend.openaudiomc.generic.networking.payloads.client.voice.ClientVoiceDropPayload;
@@ -15,13 +16,13 @@ public class PeerQueue {
private final Set dropQueue = new HashSet<>();
private final Set subscribeQueue = new HashSet<>();
- private Lock lock = new ReentrantLock();
+ private final Lock lock = new ReentrantLock();
public void drop(String streamKey) {
lock.lock();
dropQueue.add(streamKey);
- // do we have a subscribe queued? if so, remove it
+ // do we have a sub queued? if so, remove it
subscribeQueue.removeIf(clientVoiceSubscribePayload -> clientVoiceSubscribePayload.getStreamKey().equals(streamKey));
lock.unlock();
}
@@ -33,6 +34,10 @@ public void addSubscribe(
) {
ClientVoiceSubscribePayload.SerializedPeer peer = ClientVoiceSubscribePayload.SerializedPeer.fromClient(toListenTo, originLocation, options);
lock.lock();
+
+ // remove old, if present, its possible for this to be called twice with different options
+ subscribeQueue.removeIf(clientVoiceSubscribePayload -> clientVoiceSubscribePayload.getStreamKey().equals(peer.getStreamKey()));
+
subscribeQueue.add(peer);
// do we have a drop queued? if so, remove it
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/session/RtcSessionManager.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/session/RtcSessionManager.java
index 2c416470c..0da298647 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/session/RtcSessionManager.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/session/RtcSessionManager.java
@@ -1,14 +1,13 @@
package com.craftmend.openaudiomc.generic.client.session;
import com.craftmend.openaudiomc.OpenAudioMc;
-import com.craftmend.openaudiomc.api.impl.event.enums.VoiceEventCause;
import com.craftmend.openaudiomc.api.impl.event.events.*;
import com.craftmend.openaudiomc.api.interfaces.AudioApi;
+import com.craftmend.openaudiomc.api.voice.VoicePeerOptions;
import com.craftmend.openaudiomc.generic.client.enums.RtcBlockReason;
import com.craftmend.openaudiomc.generic.client.enums.RtcStateFlag;
import com.craftmend.openaudiomc.generic.client.helpers.ClientRtcLocationUpdate;
import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
-import com.craftmend.openaudiomc.generic.client.objects.VoicePeerOptions;
import com.craftmend.openaudiomc.generic.oac.OpenaudioAccountService;
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
import com.craftmend.openaudiomc.generic.node.packets.ForceMuteMicrophonePacket;
@@ -81,7 +80,7 @@ public boolean requestLinkage(ClientConnection peer, boolean mutual, VoicePeerOp
if (mutual && !peer.getRtcSessionManager().currentProximityPeers.contains(clientConnection.getOwner().getUniqueId())) {
peer.getRtcSessionManager().getCurrentProximityPeers().add(clientConnection.getOwner().getUniqueId());
peer.getPeerQueue().addSubscribe(clientConnection, peer, options);
- AudioApi.getInstance().getEventDriver().fire(new PlayerEnterVoiceProximityEvent(clientConnection, peer, VoiceEventCause.NORMAL));
+ AudioApi.getInstance().getEventDriver().fire(new PlayerEnterVoiceProximityEvent(clientConnection, peer));
peer.getRtcSessionManager().updateLocationWatcher();
}
@@ -92,7 +91,7 @@ public boolean requestLinkage(ClientConnection peer, boolean mutual, VoicePeerOp
currentProximityPeers.add(peer.getOwner().getUniqueId());
clientConnection.getPeerQueue().addSubscribe(peer, clientConnection, options);
- AudioApi.getInstance().getEventDriver().fire(new PlayerEnterVoiceProximityEvent(peer, clientConnection, VoiceEventCause.NORMAL));
+ AudioApi.getInstance().getEventDriver().fire(new PlayerEnterVoiceProximityEvent(peer, clientConnection));
updateLocationWatcher();
@@ -134,7 +133,7 @@ public void makePeersDrop() {
peer.getRtcSessionManager().updateLocationWatcher();
peer.getPeerQueue().drop(streamKey);
- AudioApi.getInstance().getEventDriver().fire(new PlayerLeaveVoiceProximityEvent(clientConnection, peer, VoiceEventCause.NORMAL));
+ AudioApi.getInstance().getEventDriver().fire(new PlayerLeaveVoiceProximityEvent(clientConnection, peer));
}
}
}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/session/SessionData.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/session/SessionData.java
index cfe17d1f3..1c4693e22 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/session/SessionData.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/client/session/SessionData.java
@@ -1,11 +1,11 @@
package com.craftmend.openaudiomc.generic.client.session;
import com.craftmend.openaudiomc.OpenAudioMc;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
import com.craftmend.openaudiomc.generic.oac.OpenaudioAccountService;
import com.craftmend.openaudiomc.generic.oac.enums.CraftmendTag;
import com.craftmend.openaudiomc.generic.environment.MagicValue;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
import com.craftmend.openaudiomc.generic.client.helpers.SerializableClient;
import com.craftmend.openaudiomc.generic.platform.Platform;
import com.craftmend.openaudiomc.generic.storage.enums.StorageKey;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/commands/subcommands/PlaySubCommand.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/commands/subcommands/PlaySubCommand.java
index 668e8dec7..f678e088e 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/commands/subcommands/PlaySubCommand.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/commands/subcommands/PlaySubCommand.java
@@ -3,16 +3,16 @@
import com.craftmend.openaudiomc.OpenAudioMc;
import com.craftmend.openaudiomc.api.interfaces.Client;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
import com.craftmend.openaudiomc.generic.commands.objects.CommandError;
-import com.craftmend.openaudiomc.generic.media.objects.OptionalError;
+import com.craftmend.openaudiomc.api.media.OptionalError;
import com.craftmend.openaudiomc.generic.media.utils.Validation;
import com.craftmend.openaudiomc.generic.platform.OaColor;
import com.craftmend.openaudiomc.generic.user.User;
import com.craftmend.openaudiomc.generic.commands.interfaces.SubCommand;
import com.craftmend.openaudiomc.generic.commands.objects.Argument;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
-import com.craftmend.openaudiomc.generic.media.objects.MediaOptions;
+import com.craftmend.openaudiomc.api.media.MediaOptions;
import lombok.SneakyThrows;
import java.util.Optional;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/MediaService.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/MediaService.java
index 5667ea8b9..a78eb5b66 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/MediaService.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/MediaService.java
@@ -4,7 +4,7 @@
import com.craftmend.openaudiomc.generic.authentication.AuthenticationService;
import com.craftmend.openaudiomc.generic.media.middleware.CdnMiddleware;
import com.craftmend.openaudiomc.generic.media.interfaces.ForcedUrlMutation;
-import com.craftmend.openaudiomc.generic.media.interfaces.UrlMutation;
+import com.craftmend.openaudiomc.api.media.UrlMutation;
import com.craftmend.openaudiomc.generic.media.middleware.DropBoxMiddleware;
import com.craftmend.openaudiomc.generic.service.Inject;
import com.craftmend.openaudiomc.generic.service.Service;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/interfaces/ForcedUrlMutation.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/interfaces/ForcedUrlMutation.java
index 89b03d466..9e8ab3bd3 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/interfaces/ForcedUrlMutation.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/interfaces/ForcedUrlMutation.java
@@ -1,5 +1,7 @@
package com.craftmend.openaudiomc.generic.media.interfaces;
+import com.craftmend.openaudiomc.api.media.UrlMutation;
+
public interface ForcedUrlMutation extends UrlMutation {
}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/interfaces/UrlMutation.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/interfaces/UrlMutation.java
deleted file mode 100644
index 910b3c7ec..000000000
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/interfaces/UrlMutation.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.craftmend.openaudiomc.generic.media.interfaces;
-
-public interface UrlMutation {
-
- /**
- * @param original the original source as entered in the command
- * @return the new url that will be send to the client
- */
- String onRequest(String original);
-
-}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/middleware/DropBoxMiddleware.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/middleware/DropBoxMiddleware.java
index 6edf0f91a..02b1f8e1b 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/middleware/DropBoxMiddleware.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/middleware/DropBoxMiddleware.java
@@ -1,6 +1,6 @@
package com.craftmend.openaudiomc.generic.media.middleware;
-import com.craftmend.openaudiomc.generic.media.interfaces.UrlMutation;
+import com.craftmend.openaudiomc.api.media.UrlMutation;
public class DropBoxMiddleware implements UrlMutation {
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/objects/Media.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/objects/Media.java
deleted file mode 100644
index 7602f15ae..000000000
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/media/objects/Media.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.craftmend.openaudiomc.generic.media.objects;
-
-import com.craftmend.openaudiomc.OpenAudioMc;
-import com.craftmend.openaudiomc.generic.media.MediaService;
-import com.craftmend.openaudiomc.generic.media.enums.MediaFlag;
-import com.craftmend.openaudiomc.generic.media.time.TimeService;
-import lombok.Getter;
-import lombok.Setter;
-
-import java.util.UUID;
-
-@Getter
-public class Media {
-
- //media tracker
- @Setter private String mediaId = UUID.randomUUID().toString();
-
- //media information
- private String source;
- @Setter private long startInstant;
- @Setter private transient int keepTimeout = -1;
- @Setter private boolean doPickup = false;
- @Setter private boolean loop = false;
- @Setter private int fadeTime = 0;
- @Setter private int volume = 100;
- @Setter private boolean muteRegions = false;
- @Setter private boolean muteSpeakers = false;
- @Setter private int startAtMillis = 0;
- @Setter private MediaFlag flag = MediaFlag.DEFAULT;
-
- /**
- * Create a new media based on a url
- * the source will first be processed by the mutation api
- * so you can just use addons without needing to wor§§ry
- *
- * @param source the resource url
- */
- public Media(String source) {
- this.source = OpenAudioMc.getService(MediaService.class).process(source);
- this.startInstant = OpenAudioMc.getService(TimeService.class).getSyncedInstant().toEpochMilli();
- }
-
- /**
- * You can apply multiple options.
- * Used by the commands to allow settings via JSON
- *
- * @param options The options. Selected via the command
- * @return instance of self
- */
- public Media applySettings(MediaOptions options) {
- this.loop = options.isLoop();
- this.keepTimeout = options.getExpirationTimeout();
- if (options.getId() != null) this.mediaId = options.getId();
- this.doPickup = options.isPickUp();
- this.setFadeTime(options.getFadeTime());
- this.volume = options.getVolume();
- this.muteRegions = options.isMuteRegions();
- this.muteSpeakers = options.isMuteSpeakers();
- this.startAtMillis = options.getStartAtMillis();
- return this;
- }
-
-}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/migrations/migrations/SpeakerDatabaseMigration.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/migrations/migrations/SpeakerDatabaseMigration.java
index 40ead1a98..761e7bf24 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/migrations/migrations/SpeakerDatabaseMigration.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/migrations/migrations/SpeakerDatabaseMigration.java
@@ -9,8 +9,8 @@
import com.craftmend.openaudiomc.generic.storage.enums.StorageLocation;
import com.craftmend.openaudiomc.generic.storage.interfaces.Configuration;
import com.craftmend.openaudiomc.spigot.modules.speakers.SpeakerService;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.ExtraSpeakerOptions;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.SpeakerType;
+import com.craftmend.openaudiomc.api.spakers.ExtraSpeakerOptions;
+import com.craftmend.openaudiomc.api.spakers.SpeakerType;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.MappedLocation;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.Speaker;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/packets/client/media/PacketClientCreateMedia.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/packets/client/media/PacketClientCreateMedia.java
index 5d3a70b4c..c469b10d8 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/packets/client/media/PacketClientCreateMedia.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/packets/client/media/PacketClientCreateMedia.java
@@ -1,6 +1,6 @@
package com.craftmend.openaudiomc.generic.networking.packets.client.media;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.networking.abstracts.AbstractPacket;
import com.craftmend.openaudiomc.generic.networking.abstracts.PacketChannel;
import com.craftmend.openaudiomc.generic.networking.payloads.client.media.ClientCreateMediaPayload;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/media/ClientCreateMediaPayload.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/media/ClientCreateMediaPayload.java
index 2dae76248..baa292d05 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/media/ClientCreateMediaPayload.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/media/ClientCreateMediaPayload.java
@@ -1,6 +1,6 @@
package com.craftmend.openaudiomc.generic.networking.payloads.client.media;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.networking.abstracts.AbstractPacketPayload;
import com.craftmend.openaudiomc.generic.networking.payloads.client.interfaces.SourceHolder;
import lombok.AllArgsConstructor;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/speakers/objects/ClientSpeaker.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/speakers/objects/ClientSpeaker.java
index b6f400c7c..f50e2780d 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/speakers/objects/ClientSpeaker.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/speakers/objects/ClientSpeaker.java
@@ -1,6 +1,6 @@
package com.craftmend.openaudiomc.generic.networking.payloads.client.speakers.objects;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.SpeakerType;
+import com.craftmend.openaudiomc.api.spakers.SpeakerType;
import com.craftmend.openaudiomc.spigot.services.world.Vector3;
import lombok.AllArgsConstructor;
import lombok.Data;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/voice/ClientVoiceOptionsPayload.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/voice/ClientVoiceOptionsPayload.java
index bf6043519..b6c982d5f 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/voice/ClientVoiceOptionsPayload.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/voice/ClientVoiceOptionsPayload.java
@@ -1,6 +1,6 @@
package com.craftmend.openaudiomc.generic.networking.payloads.client.voice;
-import com.craftmend.openaudiomc.generic.client.objects.VoicePeerOptions;
+import com.craftmend.openaudiomc.api.voice.VoicePeerOptions;
import com.craftmend.openaudiomc.generic.networking.abstracts.AbstractPacketPayload;
import lombok.AllArgsConstructor;
import lombok.Data;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/voice/ClientVoiceSubscribePayload.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/voice/ClientVoiceSubscribePayload.java
index dcb045558..a04d31165 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/voice/ClientVoiceSubscribePayload.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/networking/payloads/client/voice/ClientVoiceSubscribePayload.java
@@ -1,6 +1,6 @@
package com.craftmend.openaudiomc.generic.networking.payloads.client.voice;
-import com.craftmend.openaudiomc.generic.client.objects.VoicePeerOptions;
+import com.craftmend.openaudiomc.api.voice.VoicePeerOptions;
import com.craftmend.openaudiomc.generic.networking.abstracts.AbstractPacketPayload;
import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
import com.craftmend.openaudiomc.generic.client.helpers.ClientRtcLocationUpdate;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/generic/user/User.java b/plugin/src/main/java/com/craftmend/openaudiomc/generic/user/User.java
index fb54ba1b2..f2dd7a285 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/generic/user/User.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/generic/user/User.java
@@ -1,32 +1,30 @@
package com.craftmend.openaudiomc.generic.user;
import com.craftmend.openaudiomc.OpenAudioMc;
+import com.craftmend.openaudiomc.api.basic.Actor;
import com.craftmend.openaudiomc.api.interfaces.Client;
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
import com.craftmend.openaudiomc.generic.storage.enums.StorageKey;
import net.md_5.bungee.api.chat.TextComponent;
-import javax.annotation.Nullable;
import java.util.Optional;
import java.util.UUID;
-public interface User {
+public interface User extends Actor {
- T getOriginal();
+ // Please check inherited methods from Actor
- String getName();
- UUID getUniqueId();
+ T getOriginal();
String getIpAddress();
- boolean isAdministrator();
- boolean hasPermission(String permission);
-
void makeExecuteCommand(String command);
- void sendMessage(String message);
void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut);
+
+ // todo: this can be private where needed, should not be inherited
void sendMessage(TextComponent textComponent);
+
void sendClickableCommandMessage(String message, String hoverMessage, String command);
void sendClickableUrlMessage(String message, String hoverMessage, String url);
default void sendActionbarMessage(String message) {
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/commands/subcommands/speaker/SpeakerSetSubCommand.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/commands/subcommands/speaker/SpeakerSetSubCommand.java
index cb26cd31f..6bddb3e5f 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/commands/subcommands/speaker/SpeakerSetSubCommand.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/commands/subcommands/speaker/SpeakerSetSubCommand.java
@@ -9,7 +9,7 @@
import com.craftmend.openaudiomc.generic.user.User;
import com.craftmend.openaudiomc.spigot.modules.commands.subcommands.SpeakersSubCommand;
import com.craftmend.openaudiomc.spigot.modules.speakers.SpeakerService;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.ExtraSpeakerOptions;
+import com.craftmend.openaudiomc.api.spakers.ExtraSpeakerOptions;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.MappedLocation;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.Speaker;
import com.craftmend.openaudiomc.spigot.modules.speakers.utils.SpeakerUtils;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/players/handlers/SpeakerHandler.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/players/handlers/SpeakerHandler.java
index 64680a63d..424620556 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/players/handlers/SpeakerHandler.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/players/handlers/SpeakerHandler.java
@@ -11,8 +11,8 @@
import com.craftmend.openaudiomc.spigot.services.world.Vector3;
import com.craftmend.openaudiomc.spigot.modules.players.enums.PlayerLocationFollower;
import com.craftmend.openaudiomc.spigot.modules.speakers.SpeakerService;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.ExtraSpeakerOptions;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.SpeakerType;
+import com.craftmend.openaudiomc.api.spakers.ExtraSpeakerOptions;
+import com.craftmend.openaudiomc.api.spakers.SpeakerType;
import com.craftmend.openaudiomc.spigot.modules.players.interfaces.ITickableHandler;
import com.craftmend.openaudiomc.spigot.modules.players.objects.SpigotConnection;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.ApplicableSpeaker;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/players/objects/SpigotConnection.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/players/objects/SpigotConnection.java
index 9053f217e..50f7562be 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/players/objects/SpigotConnection.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/players/objects/SpigotConnection.java
@@ -1,6 +1,7 @@
package com.craftmend.openaudiomc.spigot.modules.players.objects;
import com.craftmend.openaudiomc.OpenAudioMc;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.environment.MagicValue;
import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
@@ -8,7 +9,6 @@
import com.craftmend.openaudiomc.generic.networking.payloads.client.speakers.ClientPlayerLocationPayload;
import com.craftmend.openaudiomc.generic.platform.interfaces.TaskService;
import com.craftmend.openaudiomc.spigot.OpenAudioMcSpigot;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
import com.craftmend.openaudiomc.spigot.modules.players.enums.PlayerLocationFollower;
import com.craftmend.openaudiomc.spigot.modules.players.events.ClientDisconnectEvent;
import com.craftmend.openaudiomc.spigot.modules.players.handlers.AudioChunkHandler;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/playlists/PlaylistService.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/playlists/PlaylistService.java
index af3f85794..882729707 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/playlists/PlaylistService.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/playlists/PlaylistService.java
@@ -4,7 +4,7 @@
import com.craftmend.openaudiomc.generic.database.internal.Repository;
import com.craftmend.openaudiomc.generic.logging.OpenAudioLogger;
import com.craftmend.openaudiomc.generic.media.MediaService;
-import com.craftmend.openaudiomc.generic.media.interfaces.UrlMutation;
+import com.craftmend.openaudiomc.api.media.UrlMutation;
import com.craftmend.openaudiomc.generic.service.Inject;
import com.craftmend.openaudiomc.generic.service.Service;
import com.craftmend.openaudiomc.spigot.modules.playlists.models.Playlist;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/RegionModule.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/RegionModule.java
index c89a3a4a1..a7004fdad 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/RegionModule.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/RegionModule.java
@@ -2,11 +2,11 @@
import com.craftmend.openaudiomc.OpenAudioMc;
import com.craftmend.openaudiomc.OpenAudioMcBuild;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.backups.BackupService;
import com.craftmend.openaudiomc.generic.database.DatabaseService;
import com.craftmend.openaudiomc.generic.logging.OpenAudioLogger;
import com.craftmend.openaudiomc.generic.media.MediaService;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
import com.craftmend.openaudiomc.generic.storage.enums.StorageKey;
import com.craftmend.openaudiomc.generic.utils.data.ArrayUtil;
import com.craftmend.openaudiomc.spigot.OpenAudioMcSpigot;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/gui/RegionEditGui.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/gui/RegionEditGui.java
index df48da9dd..de0694b88 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/gui/RegionEditGui.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/gui/RegionEditGui.java
@@ -1,9 +1,9 @@
package com.craftmend.openaudiomc.spigot.modules.regions.gui;
import com.craftmend.openaudiomc.OpenAudioMc;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.database.DatabaseService;
import com.craftmend.openaudiomc.generic.environment.MagicValue;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
import com.craftmend.openaudiomc.generic.networking.packets.client.media.PacketClientDestroyMedia;
import com.craftmend.openaudiomc.spigot.OpenAudioMcSpigot;
import com.craftmend.openaudiomc.spigot.modules.players.SpigotPlayerService;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/interfaces/AbstractRegionAdapter.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/interfaces/AbstractRegionAdapter.java
index 9f7b3d317..a5cae57e5 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/interfaces/AbstractRegionAdapter.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/interfaces/AbstractRegionAdapter.java
@@ -7,7 +7,6 @@
public abstract class AbstractRegionAdapter extends RegionAdapterBase {
-
/**
* Expose the RegionModule instance to the implementing class
*/
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/interfaces/IRegion.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/interfaces/IRegion.java
index 9f175167b..9441961cf 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/interfaces/IRegion.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/interfaces/IRegion.java
@@ -1,6 +1,6 @@
package com.craftmend.openaudiomc.spigot.modules.regions.interfaces;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.spigot.modules.regions.objects.RegionProperties;
public interface IRegion {
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/interfaces/RegionMutator.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/interfaces/RegionMutator.java
index 3c0871422..bf7453846 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/interfaces/RegionMutator.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/interfaces/RegionMutator.java
@@ -1,6 +1,6 @@
package com.craftmend.openaudiomc.spigot.modules.regions.interfaces;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.spigot.modules.regions.objects.RegionProperties;
public interface RegionMutator {
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/Region.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/Region.java
index 6b7b1f77b..f47286ce7 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/Region.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/Region.java
@@ -1,6 +1,6 @@
package com.craftmend.openaudiomc.spigot.modules.regions.objects;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.spigot.modules.regions.interfaces.IRegion;
import lombok.AllArgsConstructor;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/RegionMedia.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/RegionMedia.java
index d7f2380df..f44cf1242 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/RegionMedia.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/RegionMedia.java
@@ -1,9 +1,9 @@
package com.craftmend.openaudiomc.spigot.modules.regions.objects;
import com.craftmend.openaudiomc.OpenAudioMc;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.storage.enums.StorageKey;
-import com.craftmend.openaudiomc.generic.media.enums.MediaFlag;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
+import com.craftmend.openaudiomc.api.media.MediaFlag;
public class RegionMedia extends Media {
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/RegionProperties.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/RegionProperties.java
index 99d50f374..46d457df5 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/RegionProperties.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/RegionProperties.java
@@ -1,7 +1,7 @@
package com.craftmend.openaudiomc.spigot.modules.regions.objects;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.database.internal.DataStore;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
import com.craftmend.openaudiomc.generic.utils.data.ArrayUtil;
import com.craftmend.openaudiomc.spigot.OpenAudioMcSpigot;
import com.craftmend.openaudiomc.spigot.modules.regions.registry.WorldRegionManager;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/TimedRegionProperties.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/TimedRegionProperties.java
index 0eb8423ca..32b0d3275 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/TimedRegionProperties.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/regions/objects/TimedRegionProperties.java
@@ -1,7 +1,7 @@
package com.craftmend.openaudiomc.spigot.modules.regions.objects;
import com.craftmend.openaudiomc.OpenAudioMc;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.platform.Platform;
import com.craftmend.openaudiomc.spigot.OpenAudioMcSpigot;
import com.craftmend.openaudiomc.spigot.modules.players.SpigotPlayerService;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/SpeakerCollector.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/SpeakerCollector.java
index 4f6a63473..448b6cf03 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/SpeakerCollector.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/SpeakerCollector.java
@@ -1,10 +1,10 @@
package com.craftmend.openaudiomc.spigot.modules.speakers;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.ExtraSpeakerOptions;
+import com.craftmend.openaudiomc.api.spakers.ExtraSpeakerOptions;
import com.craftmend.openaudiomc.spigot.services.world.Vector3;
import com.craftmend.openaudiomc.generic.utils.data.TypeCounter;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.SpeakerType;
+import com.craftmend.openaudiomc.api.spakers.SpeakerType;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.ApplicableSpeaker;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.Speaker;
import lombok.AllArgsConstructor;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/SpeakerService.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/SpeakerService.java
index 20846f4d8..c5c184082 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/SpeakerService.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/SpeakerService.java
@@ -9,25 +9,22 @@
import com.craftmend.openaudiomc.generic.storage.enums.StorageKey;
import com.craftmend.openaudiomc.spigot.modules.players.SpigotPlayerService;
import com.craftmend.openaudiomc.spigot.modules.players.objects.SpigotConnection;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.ExtraSpeakerOptions;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.SpeakerType;
+import com.craftmend.openaudiomc.api.spakers.ExtraSpeakerOptions;
+import com.craftmend.openaudiomc.api.spakers.SpeakerType;
import com.craftmend.openaudiomc.spigot.OpenAudioMcSpigot;
import com.craftmend.openaudiomc.spigot.services.world.interfaces.IRayTracer;
import com.craftmend.openaudiomc.spigot.modules.speakers.listeners.SpeakerSelectListener;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.*;
import com.craftmend.openaudiomc.spigot.modules.speakers.tasks.SpeakerGarbageCollection;
import com.craftmend.openaudiomc.spigot.services.world.tracing.DummyTracer;
-import com.craftmend.openaudiomc.spigot.services.world.tracing.EstimatedRayTracer;
import com.craftmend.openaudiomc.spigot.services.server.ServerService;
import com.craftmend.openaudiomc.spigot.services.server.enums.ServerVersion;
import com.craftmend.openaudiomc.spigot.modules.speakers.listeners.SpeakerCreateListener;
import com.craftmend.openaudiomc.spigot.modules.speakers.listeners.SpeakerDestroyListener;
-import com.google.gson.Gson;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.bukkit.*;
-import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.util.*;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/listeners/SpeakerCreateListener.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/listeners/SpeakerCreateListener.java
index 51a8f6ce7..9b9e8e10f 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/listeners/SpeakerCreateListener.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/listeners/SpeakerCreateListener.java
@@ -5,8 +5,8 @@
import com.craftmend.openaudiomc.generic.environment.MagicValue;
import com.craftmend.openaudiomc.spigot.OpenAudioMcSpigot;
import com.craftmend.openaudiomc.spigot.modules.speakers.SpeakerService;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.ExtraSpeakerOptions;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.SpeakerType;
+import com.craftmend.openaudiomc.api.spakers.ExtraSpeakerOptions;
+import com.craftmend.openaudiomc.api.spakers.SpeakerType;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.MappedLocation;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.Speaker;
import com.craftmend.openaudiomc.spigot.modules.speakers.utils.SpeakerUtils;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/listeners/SpeakerSelectListener.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/listeners/SpeakerSelectListener.java
index da174c603..fad6ae83e 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/listeners/SpeakerSelectListener.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/listeners/SpeakerSelectListener.java
@@ -1,9 +1,7 @@
package com.craftmend.openaudiomc.spigot.modules.speakers.listeners;
import com.craftmend.openaudiomc.OpenAudioMc;
-import com.craftmend.openaudiomc.spigot.OpenAudioMcSpigot;
import com.craftmend.openaudiomc.spigot.modules.speakers.SpeakerService;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.ExtraSpeakerOptions;
import com.craftmend.openaudiomc.spigot.modules.speakers.menu.SpeakerMenu;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.MappedLocation;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.Speaker;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/menu/SpeakerMenu.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/menu/SpeakerMenu.java
index 2bbf391d4..46a8166f5 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/menu/SpeakerMenu.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/menu/SpeakerMenu.java
@@ -5,8 +5,8 @@
import com.craftmend.openaudiomc.generic.environment.MagicValue;
import com.craftmend.openaudiomc.spigot.modules.players.SpigotPlayerService;
import com.craftmend.openaudiomc.spigot.modules.players.objects.SpigotConnection;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.ExtraSpeakerOptions;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.SpeakerType;
+import com.craftmend.openaudiomc.api.spakers.ExtraSpeakerOptions;
+import com.craftmend.openaudiomc.api.spakers.SpeakerType;
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.Speaker;
import com.craftmend.openaudiomc.spigot.modules.speakers.utils.SpeakerUtils;
import com.craftmend.openaudiomc.spigot.services.clicklib.Item;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/ApplicableSpeaker.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/ApplicableSpeaker.java
index 5d6b739fb..af15821c5 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/ApplicableSpeaker.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/ApplicableSpeaker.java
@@ -1,6 +1,6 @@
package com.craftmend.openaudiomc.spigot.modules.speakers.objects;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.SpeakerType;
+import com.craftmend.openaudiomc.api.spakers.SpeakerType;
import com.craftmend.openaudiomc.spigot.services.world.Vector3;
import lombok.AllArgsConstructor;
import lombok.Data;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/MappedLocation.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/MappedLocation.java
index dbc9ca4aa..8157a0c0f 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/MappedLocation.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/MappedLocation.java
@@ -1,5 +1,6 @@
package com.craftmend.openaudiomc.spigot.modules.speakers.objects;
+import com.craftmend.openaudiomc.api.spakers.Loc;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -10,7 +11,7 @@
@Data
@AllArgsConstructor
-public class MappedLocation {
+public class MappedLocation implements Loc {
private int x;
private int y;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/Speaker.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/Speaker.java
index 7c19d11fa..4bf26e2a1 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/Speaker.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/Speaker.java
@@ -1,10 +1,11 @@
package com.craftmend.openaudiomc.spigot.modules.speakers.objects;
import com.craftmend.openaudiomc.OpenAudioMc;
+import com.craftmend.openaudiomc.api.spakers.BasicSpeaker;
import com.craftmend.openaudiomc.generic.database.internal.DataStore;
import com.craftmend.openaudiomc.spigot.modules.speakers.SpeakerService;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.ExtraSpeakerOptions;
-import com.craftmend.openaudiomc.spigot.modules.speakers.enums.SpeakerType;
+import com.craftmend.openaudiomc.api.spakers.ExtraSpeakerOptions;
+import com.craftmend.openaudiomc.api.spakers.SpeakerType;
import com.craftmend.storm.api.markers.Column;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -13,7 +14,7 @@
import java.util.*;
@NoArgsConstructor
-public class Speaker extends DataStore {
+public class Speaker extends DataStore implements BasicSpeaker {
@Column @Getter private String source;
@Column @Getter private UUID speakerId;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/SpeakerMedia.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/SpeakerMedia.java
index 5cfe8ae7b..d41a069e0 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/SpeakerMedia.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/speakers/objects/SpeakerMedia.java
@@ -1,9 +1,9 @@
package com.craftmend.openaudiomc.spigot.modules.speakers.objects;
import com.craftmend.openaudiomc.OpenAudioMc;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.storage.enums.StorageKey;
-import com.craftmend.openaudiomc.generic.media.enums.MediaFlag;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
+import com.craftmend.openaudiomc.api.media.MediaFlag;
import lombok.Getter;
import lombok.Setter;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/traincarts/models/TrainMedia.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/traincarts/models/TrainMedia.java
index 6620a94a7..2187bce02 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/traincarts/models/TrainMedia.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/traincarts/models/TrainMedia.java
@@ -1,7 +1,7 @@
package com.craftmend.openaudiomc.spigot.modules.traincarts.models;
import com.craftmend.openaudiomc.OpenAudioMc;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
+import com.craftmend.openaudiomc.api.media.Media;
import com.craftmend.openaudiomc.generic.media.time.TimeService;
import lombok.Data;
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/voicechat/SpigotVoiceChatService.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/voicechat/SpigotVoiceChatService.java
index e969a7bfd..77e7ebd5d 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/voicechat/SpigotVoiceChatService.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/voicechat/SpigotVoiceChatService.java
@@ -3,7 +3,6 @@
import com.craftmend.openaudiomc.OpenAudioMc;
import com.craftmend.openaudiomc.api.impl.event.ApiEventDriver;
import com.craftmend.openaudiomc.api.impl.event.enums.TickEventType;
-import com.craftmend.openaudiomc.api.impl.event.enums.VoiceEventCause;
import com.craftmend.openaudiomc.api.impl.event.events.*;
import com.craftmend.openaudiomc.api.interfaces.AudioApi;
import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
@@ -75,9 +74,6 @@ public void onEnable() {
// skip if this is disabled in the settings
if (!StorageKey.SETTINGS_VC_ANNOUNCEMENTS.getBoolean()) return;
- // only notify normal events, we don't really care about special things
- if (event.getCause() != VoiceEventCause.NORMAL) return;
-
if (event.getListener().isModerating() && !event.getSpeaker().isModerating()) {
return;
}
@@ -90,9 +86,6 @@ public void onEnable() {
// skip if this is disabled in the settings
if (!StorageKey.SETTINGS_VC_ANNOUNCEMENTS.getBoolean()) return;
- // only notify normal events, we don't really care about special things
- if (event.getCause() != VoiceEventCause.NORMAL) return;
-
if (event.getListener().isModerating() && !event.getSpeaker().isModerating()) {
return;
}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/voicechat/tasks/PlayerPeerTicker.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/voicechat/tasks/PlayerPeerTicker.java
index e14ca0357..66fae26dc 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/voicechat/tasks/PlayerPeerTicker.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/voicechat/tasks/PlayerPeerTicker.java
@@ -2,13 +2,12 @@
import com.craftmend.openaudiomc.OpenAudioMc;
import com.craftmend.openaudiomc.api.impl.event.enums.TickEventType;
-import com.craftmend.openaudiomc.api.impl.event.enums.VoiceEventCause;
import com.craftmend.openaudiomc.api.impl.event.events.PlayerLeaveVoiceProximityEvent;
import com.craftmend.openaudiomc.api.impl.event.events.SystemReloadEvent;
import com.craftmend.openaudiomc.api.impl.event.events.VoiceChatPeerTickEvent;
import com.craftmend.openaudiomc.api.interfaces.AudioApi;
+import com.craftmend.openaudiomc.api.voice.VoicePeerOptions;
import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
-import com.craftmend.openaudiomc.generic.client.objects.VoicePeerOptions;
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
import com.craftmend.openaudiomc.generic.utils.data.Filter;
import com.craftmend.openaudiomc.spigot.modules.voicechat.filters.PeerFilter;
@@ -148,7 +147,7 @@ public void run() {
}
client.getPeerQueue().drop(peer.getRtcSessionManager().getStreamKey());
- AudioApi.getInstance().getEventDriver().fire(new PlayerLeaveVoiceProximityEvent(client, peer, VoiceEventCause.NORMAL));
+ AudioApi.getInstance().getEventDriver().fire(new PlayerLeaveVoiceProximityEvent(client, peer));
client.getRtcSessionManager().updateLocationWatcher();
client.getRtcSessionManager().getCurrentProximityPeers().remove(peer.getOwner().getUniqueId());
@@ -159,7 +158,7 @@ public void run() {
peer.getPeerQueue().drop(client.getRtcSessionManager().getStreamKey());
peer.getRtcSessionManager().getCurrentProximityPeers().remove(client.getOwner().getUniqueId());
- AudioApi.getInstance().getEventDriver().fire(new PlayerLeaveVoiceProximityEvent(peer, client, VoiceEventCause.NORMAL));
+ AudioApi.getInstance().getEventDriver().fire(new PlayerLeaveVoiceProximityEvent(peer, client));
peer.getRtcSessionManager().updateLocationWatcher();
}
}
diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/velocity/modules/commands/subcommand/VelocityPlaylistCommand.java b/plugin/src/main/java/com/craftmend/openaudiomc/velocity/modules/commands/subcommand/VelocityPlaylistCommand.java
index dbb5e5555..745bb5de6 100644
--- a/plugin/src/main/java/com/craftmend/openaudiomc/velocity/modules/commands/subcommand/VelocityPlaylistCommand.java
+++ b/plugin/src/main/java/com/craftmend/openaudiomc/velocity/modules/commands/subcommand/VelocityPlaylistCommand.java
@@ -1,21 +1,13 @@
package com.craftmend.openaudiomc.velocity.modules.commands.subcommand;
import com.craftmend.openaudiomc.OpenAudioMc;
-import com.craftmend.openaudiomc.generic.client.objects.ClientConnection;
-import com.craftmend.openaudiomc.generic.commands.CommandService;
import com.craftmend.openaudiomc.generic.commands.interfaces.SubCommand;
import com.craftmend.openaudiomc.generic.commands.objects.Argument;
-import com.craftmend.openaudiomc.generic.media.objects.Media;
-import com.craftmend.openaudiomc.generic.media.objects.MediaOptions;
-import com.craftmend.openaudiomc.generic.media.objects.OptionalError;
-import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
import com.craftmend.openaudiomc.generic.node.enums.ProxiedCommand;
import com.craftmend.openaudiomc.generic.node.packets.CommandProxyPacket;
import com.craftmend.openaudiomc.generic.proxy.interfaces.UserHooks;
import com.craftmend.openaudiomc.generic.user.User;
import com.craftmend.openaudiomc.spigot.modules.proxy.objects.CommandProxyPayload;
-import com.craftmend.openaudiomc.velocity.modules.player.objects.VelocityPlayerSelector;
-import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
public class VelocityPlaylistCommand extends SubCommand {
diff --git a/pom.xml b/pom.xml
index d2f52dcff..14ceb7dcf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,11 +16,38 @@
UTF-8
6.8.10
+
+
+ org.jetbrains
+ annotations-java5
+ 24.0.1
+ compile
+
+
+ org.projectlombok
+ lombok
+ 1.18.30
+ compile
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 8
+
+
+
+
https://openaudiomc.net/
modules/jutils
+ api
plugin
modules/voice-join-permission
modules/vistas-client