示例#1
0
 public SlytherClient() {
   try {
     configuration = ConfigHandler.INSTANCE.readConfig(CONFIGURATION_FILE, ClientConfig.class);
     saveConfig();
   } catch (IOException e) {
     UIUtils.displayException("Unable to read config", e);
     Log.catching(e);
   }
   temporaryServerSelection = configuration.server;
   Reflections reflections = new Reflections("");
   Set<Class<?>> annotated = reflections.getTypesAnnotatedWith(Controller.class);
   for (Class<?> controller : annotated) {
     if (IController.class.isAssignableFrom(controller)) {
       try {
         Controller annotation = controller.getAnnotation(Controller.class);
         setController((IController) controller.getDeclaredConstructor().newInstance());
         Log.info("Using controller \"{}\" ({})", annotation.name(), controller.getSimpleName());
         break;
       } catch (Exception e) {
       }
     }
   }
   renderHandler = new RenderHandler(this);
   renderHandler.setup();
   setup();
 }