I have the language.yml set up and working perfect except when I add color support it screws up completely. I currently have this string: Code (Text): displayC = Configs.getLanguageConfig().getString(path + ".display"); display = ChatColor.translateAlternateColorCodes('&', displayC); When there is this color code in the language.yml: cow: &3Cow It simply tells me it's null: http://imgur.com/sokikO0 Any help?
You're probably not accessing the correct value in the config. In your code you're getting a value under a key named "display", but in the example you showed a key named "cow".
It then gives me this error unfortunately: Code (Text): org.bukkit.command.CommandException: Unhandled exception executing command 'msmounts' in plugin Mounts v1.0 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-dbe012b-61ef214] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot.jar:git-Spigot-dbe012b-61ef214] at org.bukkit.craftbukkit.v1_8_R2.CraftServer.dispatchCommand(CraftServer.java:646) ~[spigot.jar:git-Spigot-dbe012b-61ef214] at net.minecraft.server.v1_8_R2.PlayerConnection.handleCommand(PlayerConnection.java:1133) [spigot.jar:git-Spigot-dbe012b-61ef214] at net.minecraft.server.v1_8_R2.PlayerConnection.a(PlayerConnection.java:968) [spigot.jar:git-Spigot-dbe012b-61ef214] at net.minecraft.server.v1_8_R2.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot.jar:git-Spigot-dbe012b-61ef214] at net.minecraft.server.v1_8_R2.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot.jar:git-Spigot-dbe012b-61ef214] at net.minecraft.server.v1_8_R2.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-dbe012b-61ef214] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) [?:1.6.0_65] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [?:1.6.0_65] at java.util.concurrent.FutureTask.run(FutureTask.java:138) [?:1.6.0_65] at net.minecraft.server.v1_8_R2.SystemUtils.a(SourceFile:60) [spigot.jar:git-Spigot-dbe012b-61ef214] at net.minecraft.server.v1_8_R2.MinecraftServer.A(MinecraftServer.java:710) [spigot.jar:git-Spigot-dbe012b-61ef214] at net.minecraft.server.v1_8_R2.DedicatedServer.A(DedicatedServer.java:368) [spigot.jar:git-Spigot-dbe012b-61ef214] at net.minecraft.server.v1_8_R2.MinecraftServer.z(MinecraftServer.java:651) [spigot.jar:git-Spigot-dbe012b-61ef214] at net.minecraft.server.v1_8_R2.MinecraftServer.run(MinecraftServer.java:554) [spigot.jar:git-Spigot-dbe012b-61ef214] at java.lang.Thread.run(Thread.java:695) [?:1.6.0_65] Caused by: java.lang.NullPointerException at org.bukkit.ChatColor.translateAlternateColorCodes(ChatColor.java:210) ~[spigot.jar:git-Spigot-dbe012b-61ef214] at me.mounts.core.Inventories.createMobHead(Inventories.java:110) ~[?:?] at me.mounts.core.Inventories.createChest(Inventories.java:47) ~[?:?] at me.mounts.core.Commands.onCommand(Commands.java:28) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-dbe012b-61ef214] ... 16 more >
That seems to confirm what I was saying. What is the full string you're passing to the getString method? (path + ".display") - what's path? What is the full location of the color code in your language.yml? path.something.cow They should be the same.
Not helpful. Of course I know how to read it. Seems like an idiotic comment to me. The problem is not the path. When I remove the color code it works perfectly. When I add the &4 to Cow it stops working.
Possibly try surrounding the string with '. E.g. cow: '&4Cow' Try outputting the value of displayC to console and see if it equals "&4Cow" as you want.
Somehow the ' you entered in the yml is being changed to those ,Ao characters. You sure you used ' and not some weird character that it can't understand?
Well, seeing the fact that you still don't know how to fix a NullPointerException after seeing this tutorial makes you look more idiotic than me.
You know that reading stack traces doesn't tell you anything about how to actually fix an error, right? Just where and what caused it.
Listen here, I've dealt with hundreds of NPE, I was able to fix all of them, this might be some weird things, with my language.yml.
You might be right, here is a snapshot of what it looks like. It does change it. http://imgur.com/U39Y1ar
Not true. Getting a NPE means something was null when you were expecting it not to be, and sometimes working out why it is null can be quite difficult. Try changing the ' to ".