use of com.tvd12.ezyfoxserver.command.EzySetup in project ezyfox-server-example by tvd12.
the class SimpleChatClient method setup.
protected EzyClient setup() {
EzyClientConfig clientConfig = EzyClientConfig.builder().zoneName(ZONE_NAME).build();
EzyClients clients = EzyClients.getInstance();
EzyClient client = new EzyUTClient(clientConfig);
clients.addClient(client);
EzySetup setup = client.setup();
setup.addEventHandler(EzyEventType.CONNECTION_SUCCESS, new EzyConnectionSuccessHandler());
setup.addEventHandler(EzyEventType.CONNECTION_FAILURE, new EzyConnectionFailureHandler());
setup.addDataHandler(EzyCommand.HANDSHAKE, new ExHandshakeEventHandler());
setup.addDataHandler(EzyCommand.LOGIN, new ExLoginSuccessHandler());
setup.addDataHandler(EzyCommand.APP_ACCESS, new ExAccessAppHandler());
EzyAppSetup appSetup = setup.setupApp(APP_NAME);
appSetup.addDataHandler("chat/sendMessage", new ChatSendMessageResponseHandler());
appSetup.addDataHandler("greet", new ChatGreetResponseHandler());
appSetup.addDataHandler("hello", new ChatHelloResponseHandler());
return client;
}
use of com.tvd12.ezyfoxserver.command.EzySetup in project ezyfox-server by youngmonkeys.
the class EzySimplePluginEntry method addEventControllers.
private void addEventControllers(EzyPluginContext context, EzyBeanContext beanContext) {
EzySetup setup = context.get(EzySetup.class);
List<Object> eventControllers = beanContext.getSingletons(EzyEventHandler.class);
sortEventHandlersByPriority(eventControllers);
for (Object controller : eventControllers) {
Class<?> handlerType = controller.getClass();
EzyEventHandler annotation = handlerType.getAnnotation(EzyEventHandler.class);
String eventName = EzyEventHandlerAnnotations.getEvent(annotation);
setup.addEventController(EzyEventType.valueOf(eventName), (EzyEventController) controller);
logger.info("add event {} controller {}", eventName, controller);
}
}
use of com.tvd12.ezyfoxserver.command.EzySetup in project ezyfox-server by youngmonkeys.
the class EzySimplePluginContext method doInit.
@Override
protected void doInit() {
EzySetup setup = new EzyPluginSetupImpl(plugin);
this.sendResponse = new EzyPluginSendResponseImpl(this);
this.properties.put(EzyPluginSendResponse.class, sendResponse);
this.properties.put(EzyHandleException.class, new EzyPluginHandleExceptionImpl(plugin));
this.properties.put(EzySetup.class, setup);
this.properties.put(EzyPluginSetup.class, setup);
}
Aggregations