try {
if (event instanceof GMUserEvent) {
if (PermissionEventEnums.GMUser_Action.valueOf(event.getEventName()) != null) {
GMUserEvent UserEvent = (GMUserEvent) event;
try {
resident = TownyUniverse.getDataSource().getResident(UserEvent.getUserName());
player = plugin.getServer().getPlayerExact(resident.getName());
if (player != null) {
//setup default modes for this player.
String[] modes = getPlayerPermissionStringNode(player.getName(), PermissionNodes.TOWNY_DEFAULT_MODES.getNode()).split(",");
plugin.setPlayerMode(player, modes, false);