static void dispatchEvent(final LuaValueProxy listener, final String event, final String message) {
        if(listener == null || runtime == null || runtime.wasDisposed()) {
            return;
        }

        LuaState luaState = runtime.getLuaState();
        if(!luaState.isOpen()) {
            return;
        }

        final CoronaRuntimeTaskDispatcher dispatcher = new CoronaRuntimeTaskDispatcher(luaState);
        CoronaEnvironment.getCoronaActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                CoronaRuntimeTask task = new CoronaRuntimeTask() {
                    @Override
                    public void executeUsing(CoronaRuntime runtime) {
                        try {
                            LuaState luaState = runtime.getLuaState();
                            if (!luaState.isOpen() || listener == null) {
                                return;
                            }

                           listener.pushValue();

                            try {
                                luaState.checkType(-1, com.naef.jnlua.LuaType.FUNCTION);
                            } catch (Exception ex) {
                                ex.printStackTrace();
                                return;
                            }

                            int luaFunctionReferenceKey = luaState.ref(com.naef.jnlua.LuaState.REGISTRYINDEX);
                            luaState.rawGet(com.naef.jnlua.LuaState.REGISTRYINDEX, luaFunctionReferenceKey);
                            luaState.unref(com.naef.jnlua.LuaState.REGISTRYINDEX, luaFunctionReferenceKey);
                            luaState.newTable();
                            luaState.pushString("plugin.tapfortap.event");
                            luaState.setField(-2, "name");
                            luaState.pushString(event);
                            luaState.setField(-2, "event");
                            luaState.pushString(message);
                            luaState.setField(-2, "message");

                            luaState.call(1, 0);
                        } catch (Exception ex) {
                            ex.printStackTrace();
                        }
                    }
                };
                dispatcher.send(task);
            }
        });
    }