Search in sources :

Example 6 with EzyEvent

use of com.tvd12.ezyfoxserver.event.EzyEvent in project ezyfox-server-android-client by youngmonkeys.

the class EzySocketClient method processEvents.

protected void processEvents() {
    socketEventQueue.popAll(localEventQueue);
    try {
        for (int i = 0; i < localEventQueue.size(); ++i) {
            EzyEvent evt = localEventQueue.get(i);
            eventHandlers.handle(evt);
        }
    } finally {
        localEventQueue.clear();
    }
}
Also used : EzyEvent(com.tvd12.ezyfoxserver.client.event.EzyEvent)

Example 7 with EzyEvent

use of com.tvd12.ezyfoxserver.event.EzyEvent in project ezyfox-server by youngmonkeys.

the class EzyBroadcastPluginsEventImpl method fire.

@Override
public void fire(EzyConstant type, EzyEvent event, boolean catchException) {
    logger.debug("zone: {} broadcast to plugins event: {}", getZoneName(), type);
    Set<EzyPluginContext> pluginContexts = pluginContextMaps.get(type);
    if (pluginContexts != null) {
        for (EzyPluginContext pluginContext : pluginContexts) {
            firePluginEvent(pluginContext, type, event, catchException);
        }
    }
}
Also used : EzyPluginContext(com.tvd12.ezyfoxserver.context.EzyPluginContext)

Example 8 with EzyEvent

use of com.tvd12.ezyfoxserver.event.EzyEvent in project ezyfox-server by youngmonkeys.

the class EzyServerBootstrap method doNotifyServerReady.

protected void doNotifyServerReady() {
    EzyEvent event = new EzySimpleServerReadyEvent();
    context.handleEvent(EzyEventType.SERVER_READY, event);
    context.broadcast(EzyEventType.SERVER_READY, event, true);
}
Also used : EzyEvent(com.tvd12.ezyfoxserver.event.EzyEvent) EzySimpleServerReadyEvent(com.tvd12.ezyfoxserver.event.EzySimpleServerReadyEvent)

Example 9 with EzyEvent

use of com.tvd12.ezyfoxserver.event.EzyEvent in project ezyfox-server-android-client by youngmonkeys.

the class EzyEventHandlers method handle.

public void handle(EzyEvent event) {
    EzyEventType eventType = event.getType();
    EzyEventHandler handler = handlers.get(eventType);
    if (handler != null)
        handler.handle(event);
    else
        EzyLogger.warn("has no handler for event type: " + eventType);
}
Also used : EzyEventType(com.tvd12.ezyfoxserver.client.event.EzyEventType)

Example 10 with EzyEvent

use of com.tvd12.ezyfoxserver.event.EzyEvent in project ezyfox-server-android-client by youngmonkeys.

the class EzySocketClient method processStatuses.

protected void processStatuses() {
    socketStatuses.popAll(localSocketStatuses);
    for (int i = 0; i < localSocketStatuses.size(); ++i) {
        EzySocketStatus status = localSocketStatuses.get(i);
        if (status == EzySocketStatus.CONNECTED) {
            EzyEvent evt = new EzyConnectionSuccessEvent();
            socketEventQueue.addEvent(evt);
        } else if (status == EzySocketStatus.CONNECT_FAILED) {
            EzyEvent evt = new EzyConnectionFailureEvent(connectionFailedReason);
            socketEventQueue.addEvent(evt);
            break;
        } else if (status == EzySocketStatus.DISCONNECTED) {
            EzyEvent evt = new EzyDisconnectionEvent(disconnectReason);
            socketEventQueue.addEvent(evt);
            break;
        }
    }
    localSocketStatuses.clear();
}
Also used : EzyEvent(com.tvd12.ezyfoxserver.client.event.EzyEvent) EzyDisconnectionEvent(com.tvd12.ezyfoxserver.client.event.EzyDisconnectionEvent) EzyConnectionFailureEvent(com.tvd12.ezyfoxserver.client.event.EzyConnectionFailureEvent) EzySocketStatus(com.tvd12.ezyfoxserver.client.constant.EzySocketStatus) EzyConnectionSuccessEvent(com.tvd12.ezyfoxserver.client.event.EzyConnectionSuccessEvent)

Aggregations

EzyEvent (com.tvd12.ezyfoxserver.event.EzyEvent)4 EzyEvent (com.tvd12.ezyfoxserver.client.event.EzyEvent)3 EzySocketStatus (com.tvd12.ezyfoxserver.client.constant.EzySocketStatus)2 EzyAppContext (com.tvd12.ezyfoxserver.context.EzyAppContext)2 EzySimpleUser (com.tvd12.ezyfoxserver.entity.EzySimpleUser)2 EzyApplication (com.tvd12.ezyfoxserver.EzyApplication)1 EzyZone (com.tvd12.ezyfoxserver.EzyZone)1 EzyConnectionFailureEvent (com.tvd12.ezyfoxserver.client.event.EzyConnectionFailureEvent)1 EzyConnectionSuccessEvent (com.tvd12.ezyfoxserver.client.event.EzyConnectionSuccessEvent)1 EzyDisconnectionEvent (com.tvd12.ezyfoxserver.client.event.EzyDisconnectionEvent)1 EzyEventType (com.tvd12.ezyfoxserver.client.event.EzyEventType)1 EzyTryConnectEvent (com.tvd12.ezyfoxserver.client.event.EzyTryConnectEvent)1 EzyBroadcastAppsEventImpl (com.tvd12.ezyfoxserver.command.impl.EzyBroadcastAppsEventImpl)1 EzyPluginContext (com.tvd12.ezyfoxserver.context.EzyPluginContext)1 EzyZoneContext (com.tvd12.ezyfoxserver.context.EzyZoneContext)1 EzySimpleServerInitializingEvent (com.tvd12.ezyfoxserver.event.EzySimpleServerInitializingEvent)1 EzySimpleServerReadyEvent (com.tvd12.ezyfoxserver.event.EzySimpleServerReadyEvent)1 EzySimpleUserRemovedEvent (com.tvd12.ezyfoxserver.event.EzySimpleUserRemovedEvent)1 EzySimpleAppSetting (com.tvd12.ezyfoxserver.setting.EzySimpleAppSetting)1 EzySimpleZoneSetting (com.tvd12.ezyfoxserver.setting.EzySimpleZoneSetting)1