Skip to content

Extend Sponge event listener features #329

Open
@DenWav

Description

@DenWav

Sponge has annotation-based event listener features described here. @Getter will be nice to both auto-complete in the value string, and validate the method exists and the return type matches the parameter type.

The rest of the annotations are mostly functionally equivalent to certain code snippets or method calls that could be detected, and an intention could be added to convert those code snippets to parameter filters.

Most of these could be as easy as seeing if a method is called on the event object. The event type filter intentions could, from my understanding, be implemented by checking for instanceof statements.

@Has may cause the most issue, as it not only calls the method that @Supports calls, it also checks for existence. Still, there's only so many ways most people are going to do that, so presumably some checks could be implemented for the typical .isPresent() call.

  • @Getter Auto-Completion
  • @Getter Validation
  • Event type filter intentions:
    • @Include
    • @Exclude
  • Method signature modification intentions:
    • @First
    • @Last
    • @Before
    • @After
    • @All
    • @Root
    • @Named
      • This will not exist in API 7.
    • @Supports
    • @Has

ASM implementation of the filters may be of use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions