mojira.dev
MC-95982

Invalid sound category (source) in playsound command kicks player from server

When typing a non-exist sound category (source) in /playsound, the client losts connection to the server. Happens only when playing on a server.
a screenshot of the error code is attached.

Code analysis: https://bugs.mojang.com/browse/MC-95982?focusedCommentId=293010&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-293010

Related issues

Attachments

Comments

migrated
[media]
migrated

what is the exact command you used?

migrated

Well, when it first happened, it was a quiet complex command. Anyway, I discovered so it happens also with a simple playsound command, like this one:
/playsound minecraft:entity.player.levelup _[any word that isn't a vaild sound source]_ @p
It happens with any vaild sound name and selector.

marcono1234

Confirmed for

  • 16w05b

Could you please change the title to for example "Invalid sound category (source) in playsound command kicks player from server"

Based on a decompiled version of 16w05b I would say the reason is that the sound category is received using the public static nh a(String ?) method of the nh class. This method however simply uses the V get(Object key) of the java.util.Map class. This itself is not a problem, but all methods and classes using this method should test if the returned value is null, which the method parsing the /playsound command currently does not.

migrated

Can someone remove the Issue link to MC-96788 please? It's not a duplicate of this.

migrated

how is it not a duplicate, the report states a invalid value in the source paramater

migrated

Sorry, my fault. I didn't realized this was the idea.

migrated

Confirmed in 1.9

marcono1234

Please link to this comment in the description

The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.

What I said earlier is indeed the case. The public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException method of the net.minecraft.command.CommandPlaySound class does not test if the parsed net.minecraft.util.SoundCategory is null.

migrated

Fixed in 1.10

migrated

(Unassigned)

Community Consensus

/playsound, connection-lost, connectionlost, server

Minecraft 16w03a, Minecraft 16w05b, Minecraft 1.9

Minecraft 1.10

Retrieved