Slimefun4
Slimefun4 copied to clipboard
WIP - Allow server owners to fully customize sounds
Description
This pull request adds the SoundService
and the SoundEffect
enum which allow us to easily play sounds
but also allow server owners to easily configure and customize sounds.
Note here that I opted for the minecraft-ids of sounds rather than the bukkit constants because this will allow
server owners to use completely custom sounds in combination with resource packs.
If a sound does not exist, the player will simply not hear anything, no error will be thrown.
When values are misconfigured, a helpful warning will appear in the console. This will also protect us against Mojang sound changes in the future, as we don't have to worry about the support of changed enum constants or such.
Here is an example of the new config file:
PORTABLE_CRAFTER_OPEN_SOUND:
sound: entity.wolf.howl
volume: 1.0
pitch: 0.123456789
SPLINT_CONSUME_SOUND:
sound: entity.skeleton.hurt
volume: 1.0
pitch: 1.0
TRASH_CAN_OPEN_SOUND:
sound: i.dont.exist.btw.spinach.sucks.and.pineapple.on.pizza.rules
volume: 1.0
pitch: 1.0
ToDo (Why this is still a draft)
- [x] MockBukkit does not support String-sounds atm, so Unit Tests will fail, I will need to update MockBukkit for that first
- [ ] I would like to add Unit Tests for this sound service too
- [ ] Not all sounds have been converted yet
Checklist
- [x] I have fully tested the proposed changes and promise that they will not break everything into chaos.
- [x] I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
- [x] I followed the existing code standards and didn't mess up the formatting.
- [x] I did my best to add documentation to any public classes or methods I added.
- [x] I have added
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null values - [ ] I added sufficient Unit Tests to cover my code.
Your Pull Request was automatically labelled as: "🎈 Feature" Thank you for contributing to this project! ❤️
Can someone pull latest changes?
With the addition of #3694 this is now 2/3 done. Merging in both (and the followup with tests) into master independently to avoid one massive PR.
i was gonna spam all comments but nvm I resolved all requested changes in #3694
please pull the latest changes in this branch and then it should be ready to merge
Slimefun preview build
A Slimefun preview build is available for testing!
https://preview-builds.walshy.dev/download/Slimefun/2844/5411919802
Note: This is not a supported build and is only here for the purposes of testing. Do not run this on a live server and do not report bugs anywhere but this PR!