Use a delegate object for `MonitorAware` events

Open
#80 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
java
Domain
backend

Research direction

Start by reading the MonitorAware and MutableEvent implementations and tracing how monitoring listeners receive event objects. Compare that flow with record and inheritable events; the work is complete when the delegate-object approach is defined and the existing MutableEvent-only limitation is removed without leaving the monitoring behavior ambiguous.

Written by the indexing model from the issue text.

Description

The way the experimental MonitorAware characteristic works is that it is tied to the MutableEvent object, whose internals have tracking for the monitoring state. This allows the same event object to be passed into the listener for that event.

An idea that I have to solve needing to tie monitor-awareness to MutableEvent is to instead prompt the event to return an instance of the event that would be used for monitoring listeners. For record events, this would just be themselves since they are immutable. But for inheritable events, it would be possible to return a subtype of the event where setters throw exceptions and getters for collections return unmodifiable views. While this would be more expensive than the system currently in place, it would be far more versatile, additionally removing the limitation of needing it to strictly be a subtype of MutableEvent.

Dominant language
Java
Stars
46
Forks
39
Avg merge
2d 22h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MinecraftForge/EventBus

All issues in MinecraftForge/EventBus

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.