Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added overloads for the playSound methods that allow to pass raw sound names instead of an enum. #676

Closed
wants to merge 1 commit into from

Conversation

TomyLobo
Copy link
Contributor

Added overloads for the playSound methods that allow to pass raw sound names instead of an enum.

This allows playing custom (i.e. non-minecraft) sounds and makes playing sounds by name easier.

Accompanying this are Bukkit/CraftBukkit#881 and https://bukkit.atlassian.net/browse/BUKKIT-2443

@olliestanley
Copy link

I'm not normally one to say this, but is there a need? The problem is typos would result in problems, which is probably why they don't have it already.

@TomyLobo
Copy link
Contributor Author

TomyLobo commented Sep 4, 2012

I copied the reason from the ticket.
tbh I don't know why they even bothered making an enum.
It only causes problems...
I just noticed they say they might remove entries in the future when sounds are removed.

Let's compare this with the alternative of simply passing strings for sounds:
Option 1: enum
Sound file is removed from Minecraft
-> enum entry is removed
-> JVM throws NoSuchFieldError when the entry is being accessed
-> plugin more or less breaks, depending on where the enum entry is accessed.

Option 2: plain strings
Sound file is removed from Minecraft
-> packet with the name of a non-existing sound is sent to the client
-> client cannot find the sound
-> client discards the packet

@olliestanley
Copy link

OK, makes sense.

@Wolvereness
Copy link
Contributor

API exists for custom sounds: the custom packet. If the client is modified to have extra sounds, then we can safely assume it can also add it's own custom packet system for said sounds.

Seeing how the string handles are more intended as an internal, they were removed from the API.

Between these two points, there is not much reason to leave this PR open.

@TomyLobo
Copy link
Contributor Author

any idiot can add extra sounds with windows explorer
adding a handler for custom packets is difficult. spoutcraft has no api to deal with them and to the last of my knowledge, neither does forge
it's definitely outside the skill set of most bukkit plugin devs

@Wolvereness
Copy link
Contributor

It would take someone who knows modding clients all but 20 minutes to pipe the same packet data for sounds over custom packets.

@TomyLobo
Copy link
Contributor Author

bleh you posted while i was editing :P

any idiot can add extra sounds with windows explorer
adding a handler for custom packets, on the other hand, is difficult:
spoutcraft has no api to deal with them and to the last of my knowledge, neither does forge
it's definitely outside the skill set of most bukkit plugin devs

even if they do have the skills to modify client classes and avoid conflicts with other mods, they still have to convince their users to install executable code as opposed to just a harmless sound file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants