Event Listener JIRA eventPublisher.publish not doing anything

Hi,
I am trying to update A custom field using business logic only when B field is set. I am doing this through JIRA server plugin (no other options as this is a small part of much larger problem)
What I am trying to do -

  1. Created a custom event specifically for field getting updated.
  2. Fire custom event when the field is getting updated. As the plugin itself sets the B field.
  3. Define and listen to that custom event.

I am done with 1 and 3 part. For some reason I am not able to fire the custom event.
The code which I am using to fire the event is below -

        EventType e = null;
        e = setCustomEventId();
        //Create event if not found
        if (customEventId == null) {
            EventType newEvent = new EventType(CUSTOM_EVENT, "Hi", 2l);
            eventTypeManager.addEventType(newEvent);
            //Then set id for the event created
            e = setCustomEventId();
        }
        //call the custom event
        eventPublisher.publish(e);


//This is the method I am using to the specific evet
private EventType setCustomEventId() {
        Map<Long, EventType> eventTypesMap = eventTypeManager.getEventTypesMap();
        for (Map.Entry<Long, EventType> entry : eventTypesMap.entrySet()) {
            if (CUSTOM_EVENT.equals(entry.getValue().getName())) {
                customEventId = entry.getValue().getId();
                return eventTypesMap.get(customEventId);
            }
        }
        return null;
    }

I am not able to pin point the problem. Is it because I am creating an event dynamically and then firing it. The event listener doesn’t know about the new event (Just a speculation)
Or is the reason of this happening is because of firing new event from a event.
Firing custom event when executing code in listener of Create Issue event.