protected int getRange(Object object) { try { return getters.contains("range") ? ((LazilyParsedNumber) getters.get("range").invoke(LazilyParsedNumber.class, object, object)) .intValue() : 0; } catch (GetterException ex) { return 0; } }
public Resident getOwner(Object object) { try { EntityPlayer player = getters.contains("owner") ? (EntityPlayer) getters.get("owner").invoke(EntityPlayer.class, object, object) : null; if (player == null) return null; return MyTownUniverse.instance.getOrMakeResident(player); } catch (GetterException ex) { try { String username = getters.contains("owner") ? (String) getters.get("owner").invoke(String.class, object, object) : null; if (username == null) return null; if (username.length() == 36 && (username.split("-", -1).length - 1) == 4) { UUID uuid = UUID.fromString(username); return MyTownUniverse.instance.getOrMakeResident(uuid); } return MyTownUniverse.instance.getOrMakeResident(username); } catch (GetterException ex2) { try { UUID uuid = getters.contains("owner") ? (UUID) getters.get("owner").invoke(UUID.class, object, object) : null; if (uuid == null) return null; return MyTownUniverse.instance.getOrMakeResident(uuid); } catch (GetterException ex3) { return null; } } } }