With permission groups changing in Unity and the advent of Areas and groups I am having a little difficulty detecting what group a player is in. I have an old Java routine that parsed the name of the group and decided certain extra keys to map and routines that could be run by them in my code. Also embedded in the permission group name was a number that I could read and again provide for some extra routines they could run. The problem is the currently I cannot seem to know what group the guy is in if he is moving around areas. Mind you this is not an attribute inside the file but the name itself I was trying to read such as farmer1, farmer2 etc. The file itself was a standard permission file but has different attributes turned on or off as sort of an advancement reward. But now I am getting a bunch of [StringOutOfBounds Exceptions(0,-1) out of bounds for length 0 ] and Preconditions for several lines when I thought it would run properly. No Errors in Compile.
The routine does this onPlayerSpawnEvent() and runs just once to determine the players job. Should I set an player attribute when I read this? I wish there was a permissions name in the permissions.
Any Thoughts or examples?
currclass=player.getPermissionGroup();
String pclass = currclass.substring(0, currclass.length() - 1);
String lastChar = currclass.substring(currclass.length() - 1)
lvl1 = Short.parseShort(lastChar);
PS I am still troubleshooting this as some of the issue is that this maybe expecting Admins to be in a group also. It just is not clear to me where these errors are coming from. Maybe a null detection?