t3hk0d3/PermissionsEx — Issue #89: Players with numbers for names are not handled correctly.
Author: robnar
Created: 2011-10-15 17:57:12+00:00
State: open

I noticed today that some of my players were showing up as default when they logged in, and when I went to check their permissions I got this on the console:

----------------------------------------

2011-10-15 15:25:20 [SEVERE] null
org.bukkit.command.CommandException: Unhandled exception executing command 'pex' in plugin PermissionsEx v1.15
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:163)
at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:355)
at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:757)
at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:722)
at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:715)
at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:33)
at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:92)
at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:500)
at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:471)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
Caused by: java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String
at ru.tehkode.permissions.commands.CommandsManager.execute(CommandsManager.java:127)
at ru.tehkode.permissions.bukkit.PermissionsEx.onCommand(PermissionsEx.java:126)
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
... 13 more
Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String
at ru.tehkode.permissions.backends.FileBackend.getRegisteredUsers(FileBackend.java:207)
at ru.tehkode.permissions.PermissionBackend.getUsers(PermissionBackend.java:204)
at ru.tehkode.permissions.PermissionManager.getUsers(PermissionManager.java:140)
at ru.tehkode.permissions.bukkit.commands.PermissionsCommand.autoCompletePlayerName(PermissionsCommand.java:98)
at ru.tehkode.permissions.bukkit.commands.PermissionsCommand.autoCompletePlayerName(PermissionsCommand.java:65)
at ru.tehkode.permissions.bukkit.commands.UserCommands.userListAliasPermissions(UserCommands.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at ru.tehkode.permissions.commands.CommandsManager$CommandBinding.call(CommandsManager.java:298)
at ru.tehkode.permissions.commands.CommandsManager.execute(CommandsManager.java:120)
... 15 more

---------------------------------------------------

I looked over your code and saw that the error was happening when it tried to pull a username out of the PermissionsManager users Map, so I suspected Java was trying to do an implicit cast behind the scenes. I removed a player with an all-numeric name and then reloaded the config--now everything works.