{"action":"created","issue":{"url":"https://api.github.com/repos/SpongePowered/Sponge/issues/223","labels_url":"https://api.github.com/repos/SpongePowered/Sponge/issues/223/labels{/name}","comments_url":"https://api.github.com/repos/SpongePowered/Sponge/issues/223/comments","events_url":"https://api.github.com/repos/SpongePowered/Sponge/issues/223/events","html_url":"https://github.com/SpongePowered/Sponge/issues/223","id":65971884,"number":223,"title":"Register event listeners with protected/default/private access modifiers","user":{"login":"boformer","id":2014500,"avatar_url":"https://avatars.githubusercontent.com/u/2014500?v=3","gravatar_id":"","url":"https://api.github.com/users/boformer","html_url":"https://github.com/boformer","followers_url":"https://api.github.com/users/boformer/followers","following_url":"https://api.github.com/users/boformer/following{/other_user}","gists_url":"https://api.github.com/users/boformer/gists{/gist_id}","starred_url":"https://api.github.com/users/boformer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boformer/subscriptions","organizations_url":"https://api.github.com/users/boformer/orgs","repos_url":"https://api.github.com/users/boformer/repos","events_url":"https://api.github.com/users/boformer/events{/privacy}","received_events_url":"https://api.github.com/users/boformer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/events","name":"events","color":"050085"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/input%20wanted","name":"input wanted","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-04-02T17:22:23Z","updated_at":"2015-04-04T17:59:18Z","closed_at":null,"body":"Right now it is only possible to register events in public classes with public event listener methods.\r\n\r\n1. It is possible to register protected/default/private event listener **classes**, but when Sponge tries to call the methods, a ``java.lang.IllegalAccessError`` is thrown.\r\n2. Sponge ignores non-public event listener **methods**, except for the ``onPreInitialization`` method (why???):\r\n```java\r\n@Plugin(id = \"spongetest\", name = \"SpongeTest\", version = \"0.1.0\")\r\npublic class SpongeTestPlugin {\r\n\r\n    @Inject\r\n    private Logger logger;\r\n\r\n    @Subscribe\r\n    private void onPreInitialization(PreInitializationEvent event) {\r\n        // not ignored WTF?\r\n        logger.info(\"Sponge Test plugin loaded.\");\r\n    }\r\n    @Subscribe\r\n    private void onCommand(CommandEvent event) {\r\n        // ignored\r\n    }\r\n    @Subscribe\r\n    void onPlayerJoin(PlayerJoinEvent event) {\r\n        // ignored\r\n    }\r\n    @Subscribe\r\n    protected void onPlayerChat(PlayerChatEvent event) {\r\n        // ignored\r\n    }\r\n    @Subscribe\r\n    public void onPlayerQuit(PlayerQuitEvent event) {\r\n        // not ignored\r\n    }\r\n}\r\n```\r\n\r\nI would like to have both options: Register non-public event classes, and non-public event methods. Is it possible?"},"comment":{"url":"https://api.github.com/repos/SpongePowered/Sponge/issues/comments/89630981","html_url":"https://github.com/SpongePowered/Sponge/issues/223#issuecomment-89630981","issue_url":"https://api.github.com/repos/SpongePowered/Sponge/issues/223","id":89630981,"user":{"login":"Minecrell","id":3035868,"avatar_url":"https://avatars.githubusercontent.com/u/3035868?v=3","gravatar_id":"","url":"https://api.github.com/users/Minecrell","html_url":"https://github.com/Minecrell","followers_url":"https://api.github.com/users/Minecrell/followers","following_url":"https://api.github.com/users/Minecrell/following{/other_user}","gists_url":"https://api.github.com/users/Minecrell/gists{/gist_id}","starred_url":"https://api.github.com/users/Minecrell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Minecrell/subscriptions","organizations_url":"https://api.github.com/users/Minecrell/orgs","repos_url":"https://api.github.com/users/Minecrell/repos","events_url":"https://api.github.com/users/Minecrell/events{/privacy}","received_events_url":"https://api.github.com/users/Minecrell/received_events","type":"User","site_admin":false},"created_at":"2015-04-04T17:59:18Z","updated_at":"2015-04-04T17:59:18Z","body":"IMO even the state event handlers should go through our event bus instead of being called separately. This would make this consistent for these and for the other events."}}