I'm attempting to make a command in which you'd type something such as /sound AMBIENCE_CAVE and it would play that sound to the player who sent it. This is what I have done so far: Code:java Sound sound = Sound.valueOf(args[1].toUpperCase());float volume = Float.parseFloat(args[2]);float pitch = Float.parseFloat(args[3]);player.playSound(player.getLocation(), sound, volume, pitch);pcplayer.sendMessage("Playing sound " + yellow + args[1].toUpperCase() + aqua + " with volume " + yellow + volume + aqua + " and pitch " + yellow + pitch + aqua + "!", player); This returns an error: Code: 2013-09-16 03:39:54 [SEVERE] null org.bukkit.command.CommandException: Unhandled exception executing command 'sound' in plugin PwnCraft v1.0 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:191) at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchCommand(CraftServer.java:523) at net.minecraft.server.v1_6_R2.PlayerConnection.handleCommand(PlayerConnection.java:962) at net.minecraft.server.v1_6_R2.PlayerConnection.chat(PlayerConnection.java:880) at net.minecraft.server.v1_6_R2.PlayerConnection.a(PlayerConnection.java:837) at net.minecraft.server.v1_6_R2.Packet3Chat.handle(SourceFile:49) at net.minecraft.server.v1_6_R2.NetworkManager.b(NetworkManager.java:296) at net.minecraft.server.v1_6_R2.PlayerConnection.e(PlayerConnection.java:116) at net.minecraft.server.v1_6_R2.ServerConnection.b(SourceFile:37) at net.minecraft.server.v1_6_R2.DedicatedServerConnection.b(SourceFile:30) at net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:590) at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:226) at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:486) at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:419) at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582) Caused by: java.lang.ArrayIndexOutOfBoundsException: 1 at com.pwncraftpvp.PwnCraft.PwnCraft.onCommand(PwnCraft.java:971) at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ... 15 more So, I'm asking if Sound.valueOf is in correct use and if not, how would I make this command work?
java.lang.ArrayIndexOutOfBoundsException: 1 In your error. So, I think you'd use Code:java Sound sound = Sound.valueOf(args[0].toUpperCase());float volume = Float.parseFloat(args[1]);float pitch = Float.parseFloat(args[2]); instead of Code:java Sound sound = Sound.valueOf(args[1].toUpperCase());float volume = Float.parseFloat(args[2]);float pitch = Float.parseFloat(args[3]);