diff --git a/client/public/metadata.json b/client/public/metadata.json index 8e58d76ea..8f8758eb7 100644 --- a/client/public/metadata.json +++ b/client/public/metadata.json @@ -1 +1 @@ -{"buildMajor":1,"buildMinor":125,"buildRevision":240,"buildTag":"dev","buildDate":"Sun May 05 2024","build":"1.125.240 dev"} \ No newline at end of file +{"buildMajor":1,"buildMinor":125,"buildRevision":241,"buildTag":"dev","buildDate":"Fri May 31 2024","build":"1.125.241 dev"} \ No newline at end of file diff --git a/client/src/client/services/media/MediaManager.jsx b/client/src/client/services/media/MediaManager.jsx index ac008e4a0..610dace12 100644 --- a/client/src/client/services/media/MediaManager.jsx +++ b/client/src/client/services/media/MediaManager.jsx @@ -86,6 +86,7 @@ export const MediaManager = new class IMediaManager { const channel = chls[i]; if (all) { channel.fadeChannel(0, time, () => { + console.log('callback reached'); this.mixer.removeChannel(channel); }); matchedAndStopped = channel; diff --git a/client/src/client/services/media/objects/Channel.jsx b/client/src/client/services/media/objects/Channel.jsx index adb86c1e9..cc214886a 100644 --- a/client/src/client/services/media/objects/Channel.jsx +++ b/client/src/client/services/media/objects/Channel.jsx @@ -1,10 +1,10 @@ import { getGlobalState } from '../../../../state/store'; -import { debugLog } from '../../debugging/DebugService'; export class Channel { - constructor(channelName) { + constructor(channelName, originalVolume = 100) { this.channelName = channelName; - this.channelVolume = 100; + this.channelVolume = originalVolume; + this.originalVolume = originalVolume; this.sounds = []; this.mixer = null; this.targetAfterFade = 0; @@ -12,6 +12,20 @@ export class Channel { this.fadeTimer = []; this.tags = new Map(); this.trackable = false; + this.prefferedFadeTime = 2; + } + + getOriginalVolume() { + return this.originalVolume; + } + + setPrefferedFadeTime(fadeTime) { + console.log('Setting preffered fade time to', fadeTime); + this.prefferedFadeTime = fadeTime; + } + + getPrefferedFadeTime() { + return this.prefferedFadeTime || 2; } setTag(name) { @@ -65,7 +79,6 @@ export class Channel { // is the fade time set to 0? then just set the volume, do callback and return if (time === 0) { - debugLog('Fading channel', this.channelName, 'to', targetVolume, 'instantly'); this.setChannelVolume(targetVolume); extraCallback(); return; diff --git a/client/src/client/services/media/objects/Mixer.jsx b/client/src/client/services/media/objects/Mixer.jsx index 65d6c80ac..b7198b1dc 100644 --- a/client/src/client/services/media/objects/Mixer.jsx +++ b/client/src/client/services/media/objects/Mixer.jsx @@ -57,10 +57,22 @@ export class Mixer { } }); - if (score >= 1) { - channel.setMediaMuted(true); - } else { - channel.setMediaMuted(false); + const fade = channel.getPrefferedFadeTime() > 5; + + if (score >= 1 && !channel.mutedByScore) { + channel.mutedByScore = true; + if (fade) { + channel.fadeChannel(0, channel.getPrefferedFadeTime()); + } else { + channel.setChannelVolume(0); + } + } else if (score === 0 && channel.mutedByScore) { + channel.mutedByScore = false; + if (fade) { + channel.fadeChannel(channel.getOriginalVolume(), channel.getPrefferedFadeTime()); + } else { + channel.setChannelVolume(channel.getOriginalVolume()); + } } }); } diff --git a/client/src/client/services/socket/handlers/HandleCreateMedia.jsx b/client/src/client/services/socket/handlers/HandleCreateMedia.jsx index c088a4298..c9607eebd 100644 --- a/client/src/client/services/socket/handlers/HandleCreateMedia.jsx +++ b/client/src/client/services/socket/handlers/HandleCreateMedia.jsx @@ -30,8 +30,9 @@ export async function handleCreateMedia(data) { MediaManager.destroySounds(id, false, true); // register with metadata - const createdChannel = new Channel(id); + const createdChannel = new Channel(id, volume); createdChannel.trackable = true; + createdChannel.setPrefferedFadeTime(fadeTime); const createdMedia = new Sound(); createdChannel.addSound(createdMedia); diff --git a/client/src/client/services/socket/handlers/HandleDestroyMedia.jsx b/client/src/client/services/socket/handlers/HandleDestroyMedia.jsx index 61e863b53..87e5e99a1 100644 --- a/client/src/client/services/socket/handlers/HandleDestroyMedia.jsx +++ b/client/src/client/services/socket/handlers/HandleDestroyMedia.jsx @@ -1,6 +1,7 @@ import { MediaManager } from '../../media/MediaManager'; export function handleDestroyMedia(data) { + console.log(data); const succeeded = MediaManager.destroySounds(data.soundId, data.all, false, data.fadeTime); if (!succeeded) { // eslint-disable-next-line no-console diff --git a/client/src/metadata.json b/client/src/metadata.json index 8e58d76ea..8f8758eb7 100644 --- a/client/src/metadata.json +++ b/client/src/metadata.json @@ -1 +1 @@ -{"buildMajor":1,"buildMinor":125,"buildRevision":240,"buildTag":"dev","buildDate":"Sun May 05 2024","build":"1.125.240 dev"} \ No newline at end of file +{"buildMajor":1,"buildMinor":125,"buildRevision":241,"buildTag":"dev","buildDate":"Fri May 31 2024","build":"1.125.241 dev"} \ No newline at end of file diff --git a/dev-resources/spawn-test-spigot.sh b/dev-resources/spawn-test-spigot.sh index 1cafb0a56..beebed30b 100755 --- a/dev-resources/spawn-test-spigot.sh +++ b/dev-resources/spawn-test-spigot.sh @@ -16,10 +16,10 @@ cp dev-resources/ops.json test-server-spigot/ cd test-server-spigot echo "Cleaning server..." -if [ ! -f ./spigot-1.20.2.jar ]; then - wget https://download.getbukkit.org/spigot/spigot-1.20.2.jar +if [ ! -f ./spigot-1.20.4.jar ]; then + wget https://download.getbukkit.org/spigot/spigot-1.20.4.jar echo "eula=true" > eula.txt - chmod +x spigot-1.20.2.jar + chmod +x spigot-1.20.4.jar fi #export OA_ENVIRONMENT="DEVELOPMENT" @@ -29,4 +29,4 @@ echo "Starting server.." rm world/session.lock rm world_the_end/session.lock rm world_nether/session.lock -java -Xms3G -Xmx3G -DIReallyKnowWhatIAmDoingISwear -jar paper-1.20.6-49.jar nogui +java -Xms3G -Xmx3G -DIReallyKnowWhatIAmDoingISwear -jar spigot-1.20.4.jar nogui diff --git a/modules/vistas-server/dependency-reduced-pom.xml b/modules/vistas-server/dependency-reduced-pom.xml index 3cb256284..922179d83 100644 --- a/modules/vistas-server/dependency-reduced-pom.xml +++ b/modules/vistas-server/dependency-reduced-pom.xml @@ -174,12 +174,6 @@ junit 4.13.2 test - - - hamcrest-core - org.hamcrest - - diff --git a/plugin/src/main/bash/data.bin b/plugin/src/main/bash/data.bin index 5e8528e58..3cd16e968 100755 --- a/plugin/src/main/bash/data.bin +++ b/plugin/src/main/bash/data.bin @@ -1 +1 @@ -BUILD_NUM="1433" +BUILD_NUM="1438" 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 46d457df5..93b6bf28d 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 @@ -45,6 +45,7 @@ public Media getMediaForWorld(WorldRegionManager worldRegionManager) { if (loop == null) loop = true; Media media = worldRegionManager.getRegionMedia(source, volume, fadeTimeMs, loop); media.setDoPickup(this.doSync); + media.setFadeTime(fadeTimeMs); return media; } diff --git a/plugin/src/main/resources/data.bin b/plugin/src/main/resources/data.bin index 5e8528e58..3cd16e968 100755 --- a/plugin/src/main/resources/data.bin +++ b/plugin/src/main/resources/data.bin @@ -1 +1 @@ -BUILD_NUM="1433" +BUILD_NUM="1438" diff --git a/plugin/src/main/resources/openaudiomc-build.properties b/plugin/src/main/resources/openaudiomc-build.properties index dc714b394..f9adf3737 100644 --- a/plugin/src/main/resources/openaudiomc-build.properties +++ b/plugin/src/main/resources/openaudiomc-build.properties @@ -1,3 +1,3 @@ -BUILD_VERSION="1433" -BUILD_COMMIT="e9dd7b36b9ce027c21f01124492be0a47231f1cb" +BUILD_VERSION="1438" +BUILD_COMMIT="b185ac1858bdbe73f0106928153783356d59ef1b" BUILD_AUTHOR="Mats"