-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e97e1d
commit 59e8c03
Showing
68 changed files
with
801 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<parent> | ||
<artifactId>OpenAudioMc-Parent</artifactId> | ||
<groupId>com.craftmend.openaudiomc</groupId> | ||
<version>1.2</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>openaudiomc-api</artifactId> | ||
<name>openaudiomc-api</name> | ||
<version>${oa.version}</version> | ||
<build> | ||
<resources> | ||
<resource> | ||
<filtering>true</filtering> | ||
<directory>src/main/resources</directory> | ||
</resource> | ||
</resources> | ||
<finalName>openaudiomc-api</finalName> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<source>${java.version}</source> | ||
<target>${java.version}</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>3.2.4</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>1.18.30</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
<properties> | ||
<java.version>1.8</java.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
168 changes: 65 additions & 103 deletions
168
api/src/main/java/com/craftmend/openaudiomc/api/media/Media.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,159 +1,121 @@ | ||
package com.craftmend.openaudiomc.api.media; | ||
|
||
public interface Media { | ||
import com.craftmend.openaudiomc.api.MediaApi; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
/** | ||
* 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. | ||
* | ||
* @return the unique id of the media | ||
*/ | ||
String getMediaId(); | ||
import java.util.UUID; | ||
|
||
@Getter | ||
public class Media { | ||
|
||
/** | ||
* Source value for the media. Typically, a web compatible web link or translatable OA value | ||
* | ||
* @return the source of the media | ||
*/ | ||
String getSource(); | ||
private final String source; | ||
|
||
/** | ||
* The volume of the media, 0-100 | ||
* | ||
* @return the volume of the media | ||
* 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. | ||
*/ | ||
int getVolume(); | ||
@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) | ||
* | ||
* @return the start instant of the media | ||
*/ | ||
long getStartInstant(); | ||
|
||
@Setter | ||
private long startInstant; | ||
|
||
/** | ||
* The starting point of the media, in milliseconds. 0 by default, but can be used to skip intros or start at a certain point. | ||
* | ||
* @return the starting point of the media | ||
* 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. | ||
*/ | ||
int startAtMillis(); | ||
@Setter | ||
private transient int keepTimeout = -1; | ||
|
||
/** | ||
* If the media should loop (jumping back to startAtMillis and playing again) | ||
* | ||
* @return if the media should loop | ||
* If the media should attempt to pick up where its currently according to the time spent since the start instant. | ||
*/ | ||
boolean loopMedia(); | ||
@Setter | ||
private boolean doPickup = false; | ||
|
||
/** | ||
* If the media should attempt to pick up where its currently according to the time spent since the start instant. | ||
* | ||
* @return if the media should attempt to pick up | ||
* If the media should loop (jumping back to startAtMillis and playing again) | ||
*/ | ||
boolean doPickup(); | ||
@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. | ||
* | ||
* @return the fade time of the media | ||
*/ | ||
int getFadeTime(); | ||
@Setter | ||
private int fadeTime = 0; | ||
|
||
/** | ||
* 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. | ||
* | ||
* @return the keep timeout of the media | ||
* The volume of the media, 0-100 | ||
*/ | ||
int getKeepTimeout(); | ||
@Setter | ||
private int volume = 100; | ||
|
||
/** | ||
* If this media will mute current regions while playing. This is used to prevent overlapping media in regions. | ||
* | ||
* @return if the media will mute regions | ||
*/ | ||
boolean muteRegions(); | ||
@Setter | ||
private boolean muteRegions = false; | ||
|
||
/** | ||
* If this media will mute the speakers of the client. This is used to prevent overlapping media with speakers. | ||
* | ||
* @return if the media will mute speakers | ||
*/ | ||
boolean muteSpeakers(); | ||
|
||
/** | ||
* New media ID, used to identify the media for regions, stop commands and other features, can be any non-null string | ||
* | ||
* @param mediaId the new media id | ||
*/ | ||
void setMediaId(String mediaId); | ||
|
||
/** | ||
* Epoch millisecond timestamp of when the media started playing, used by the client to calculate the current position. | ||
* | ||
* @param startInstant the new start instant | ||
*/ | ||
void setStartInstant(long startInstant); | ||
|
||
/** | ||
* Amount of seconds to keep track of this media for, used to retroactively play media if a client connected too late. | ||
* | ||
* @param keepTimeout the new keep timeout in seconds | ||
*/ | ||
void setKeepTimeout(int keepTimeout); | ||
@Setter | ||
private boolean muteSpeakers = false; | ||
|
||
/** | ||
* If the media should attempt to pick up where its currently according to the time spent since the start instant. | ||
* | ||
* @param doPickup if the media should attempt to pick up | ||
*/ | ||
void setDoPickup(boolean doPickup); | ||
|
||
/** | ||
* If the media should loop (jumping back to startAtMillis and playing again), defaults to false | ||
* | ||
* @param loopMedia if the media should loop | ||
*/ | ||
void setLoopMedia(boolean loopMedia); | ||
|
||
|
||
/** | ||
* The amount of milliseconds to fade in or out. 0 by default, but can be used to create smooth transitions | ||
* | ||
* @param fadeTime the new fade time | ||
*/ | ||
void setFadeTime(int fadeTime); | ||
|
||
/** | ||
* The volume of the media, 0-100 | ||
* | ||
* @param volume the new volume | ||
* The starting point of the media, in milliseconds. 0 by default, but can be used to skip intros or start at a certain point. | ||
*/ | ||
void setVolume(int volume); | ||
@Setter | ||
private int startAtMillis = 0; | ||
|
||
/** | ||
* if this media should mute current regions while playing. This is used to prevent overlapping media in regions. | ||
* | ||
* @param muteRegions if the media should mute regions | ||
* 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. | ||
*/ | ||
void setMuteRegions(boolean muteRegions); | ||
@Setter | ||
private MediaFlag flag = MediaFlag.DEFAULT; | ||
|
||
/** | ||
* if this media should mute the speakers of the client. This is used to prevent overlapping media with speakers. | ||
* 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 muteSpeakers if the media should mute speakers | ||
* @param source the resource url | ||
*/ | ||
void setMuteSpeakers(boolean muteSpeakers); | ||
public Media(String source) { | ||
this.source = MediaApi.getInstance().translateSource(source); | ||
this.startInstant = MediaApi.getInstance().getNormalizedCurrentEpoch(); | ||
} | ||
|
||
/** | ||
* The starting point of the media, in miliseconds. 0 by default, but can be used to skip intros or start at a certain point. | ||
* You can apply multiple options. | ||
* Used by the commands to allow settings via JSON | ||
* | ||
* @param startAtMillis the new starting point | ||
* @param options The options. Selected via the command | ||
* @return instance of self | ||
*/ | ||
void setStartAtMillis(int startAtMillis); | ||
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; | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...udiomc/generic/media/enums/MediaFlag.java → ...mend/openaudiomc/api/media/MediaFlag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...c/generic/media/objects/MediaOptions.java → ...d/openaudiomc/api/media/MediaOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../generic/media/objects/OptionalError.java → .../openaudiomc/api/media/OptionalError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
api/src/main/java/com/craftmend/openaudiomc/generic/media/objects/Media.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
Binary file not shown.
Binary file modified
BIN
+716 Bytes
(660%)
api/target/classes/com/craftmend/openaudiomc/api/ClientApi.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-692 Bytes
api/target/classes/com/craftmend/openaudiomc/api/basic/Media.class
Binary file not shown.
Binary file modified
BIN
+277 Bytes
(180%)
api/target/classes/com/craftmend/openaudiomc/api/clients/Client.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.17 KB
api/target/classes/com/craftmend/openaudiomc/api/media/MediaFlag.class
Binary file not shown.
Binary file added
BIN
+4.19 KB
api/target/classes/com/craftmend/openaudiomc/api/media/MediaOptions.class
Binary file not shown.
Binary file added
BIN
+644 Bytes
api/target/classes/com/craftmend/openaudiomc/api/media/OptionalError.class
Binary file not shown.
Binary file added
BIN
+387 Bytes
api/target/classes/com/craftmend/openaudiomc/api/media/UrlMutation.class
Binary file not shown.
Binary file added
BIN
+519 Bytes
api/target/classes/com/craftmend/openaudiomc/api/regions/AudioRegion.class
Binary file not shown.
Binary file added
BIN
+862 Bytes
api/target/classes/com/craftmend/openaudiomc/api/spakers/BasicSpeaker.class
Binary file not shown.
Binary file added
BIN
+5.37 KB
api/target/classes/com/craftmend/openaudiomc/api/spakers/ExtraSpeakerOptions.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.62 KB
api/target/classes/com/craftmend/openaudiomc/api/spakers/SpeakerType.class
Binary file not shown.
Binary file added
BIN
+1.84 KB
api/target/classes/com/craftmend/openaudiomc/api/voice/VoicePeerOptions.class
Binary file not shown.
Binary file added
BIN
+514 Bytes
api/target/classes/com/craftmend/openaudiomc/generic/media/objects/Media.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#Generated by Maven | ||
#Fri Feb 02 23:37:46 CET 2024 | ||
#Sat Feb 03 17:05:18 CET 2024 | ||
artifactId=openaudiomc-api | ||
groupId=com.craftmend.openaudiomc | ||
version=6.8.10 |
19 changes: 17 additions & 2 deletions
19
api/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
com/craftmend/openaudiomc/api/media/MediaFlag.class | ||
com/craftmend/openaudiomc/api/media/MediaOptions.class | ||
com/craftmend/openaudiomc/api/media/OptionalError.class | ||
com/craftmend/openaudiomc/api/media/UrlMutation.class | ||
com/craftmend/openaudiomc/generic/media/objects/Media.class | ||
com/craftmend/openaudiomc/api/ClientApi.class | ||
com/craftmend/openaudiomc/api/WorldApi.class | ||
com/craftmend/openaudiomc/api/media/Media.class | ||
com/craftmend/openaudiomc/api/basic/Actor.class | ||
com/craftmend/openaudiomc/api/spakers/ExtraSpeakerOptions.class | ||
com/craftmend/openaudiomc/api/spakers/BasicSpeaker.class | ||
com/craftmend/openaudiomc/api/voice/VoicePeerOptions.class | ||
com/craftmend/openaudiomc/api/clients/Client.class | ||
com/craftmend/openaudiomc/api/basic/Media.class | ||
com/craftmend/openaudiomc/api/ClientApi.class | ||
com/craftmend/openaudiomc/api/VoiceApi.class | ||
com/craftmend/openaudiomc/api/spakers/Loc.class | ||
com/craftmend/openaudiomc/api/MediaApi.class | ||
com/craftmend/openaudiomc/api/ApiHolder.class | ||
com/craftmend/openaudiomc/api/spakers/SpeakerType.class | ||
com/craftmend/openaudiomc/api/regions/AudioRegion.class |
Oops, something went wrong.