{"action":"created","issue":{"url":"https://api.github.com/repos/wizards-of-lua/wizards-of-lua/issues/56","repository_url":"https://api.github.com/repos/wizards-of-lua/wizards-of-lua","labels_url":"https://api.github.com/repos/wizards-of-lua/wizards-of-lua/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/wizards-of-lua/wizards-of-lua/issues/56/comments","events_url":"https://api.github.com/repos/wizards-of-lua/wizards-of-lua/issues/56/events","html_url":"https://github.com/wizards-of-lua/wizards-of-lua/issues/56","id":258083694,"number":56,"title":"Support cancelable events","user":{"login":"mkarneim","id":1084732,"avatar_url":"https://avatars1.githubusercontent.com/u/1084732?v=4","gravatar_id":"","url":"https://api.github.com/users/mkarneim","html_url":"https://github.com/mkarneim","followers_url":"https://api.github.com/users/mkarneim/followers","following_url":"https://api.github.com/users/mkarneim/following{/other_user}","gists_url":"https://api.github.com/users/mkarneim/gists{/gist_id}","starred_url":"https://api.github.com/users/mkarneim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkarneim/subscriptions","organizations_url":"https://api.github.com/users/mkarneim/orgs","repos_url":"https://api.github.com/users/mkarneim/repos","events_url":"https://api.github.com/users/mkarneim/events{/privacy}","received_events_url":"https://api.github.com/users/mkarneim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-09-15T15:44:02Z","updated_at":"2017-09-17T17:45:54Z","closed_at":null,"author_association":"OWNER","body":"Since most Forge events are cancelable we should think about how we could support this."},"comment":{"url":"https://api.github.com/repos/wizards-of-lua/wizards-of-lua/issues/comments/330065221","html_url":"https://github.com/wizards-of-lua/wizards-of-lua/issues/56#issuecomment-330065221","issue_url":"https://api.github.com/repos/wizards-of-lua/wizards-of-lua/issues/56","id":330065221,"user":{"login":"Adrodoc55","id":15145501,"avatar_url":"https://avatars0.githubusercontent.com/u/15145501?v=4","gravatar_id":"","url":"https://api.github.com/users/Adrodoc55","html_url":"https://github.com/Adrodoc55","followers_url":"https://api.github.com/users/Adrodoc55/followers","following_url":"https://api.github.com/users/Adrodoc55/following{/other_user}","gists_url":"https://api.github.com/users/Adrodoc55/gists{/gist_id}","starred_url":"https://api.github.com/users/Adrodoc55/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Adrodoc55/subscriptions","organizations_url":"https://api.github.com/users/Adrodoc55/orgs","repos_url":"https://api.github.com/users/Adrodoc55/repos","events_url":"https://api.github.com/users/Adrodoc55/events{/privacy}","received_events_url":"https://api.github.com/users/Adrodoc55/received_events","type":"User","site_admin":false},"created_at":"2017-09-17T17:45:54Z","updated_at":"2017-09-17T17:45:54Z","author_association":"CONTRIBUTOR","body":"I can agree on the second point, I just wanted to point out the difference between event queues and event handlers there, but I really dislike the restriction of only alowing a single event handler per event.\r\nThis restriction evectively prevents the use of event handlers in lua code. In my opinion it is very similar to Minecrafts [gamerule gameLoopFunction](https://minecraft.gamepedia.com/Function#Commands) which only allows a single function to be registered, but that function can then call other functions.\r\nThe problem is, that a spell can't really change the gist of the current event handler to add something dynamically.\r\nFor example imagine a spell, that makes it so you can't break blocks with some enchanted item and let something else happen instead. If you allow multiple event handlers this is easy, just add an event handler for a BlockBreakEvent that checks for the held item and cancels the event. To disable the spell just remove the event handler.\r\nIf you can only have a single event handler you'll need to update your gist that contains an event handler for all BlockBreak related spells to also call a function for your new behaviour, but now you can't enable/disable that \"spell\" in Minecraft, you'll always have to edit the gist.\r\nOn top of that, spells that need to cancel events under specific circumstances are harder to write. Imagine a spell that prevents you from breaking blocks when it is raining. You can use an event queue to listen to weather changes and when it starts raining you could just add a BlockBreakEventHandler that cancels all events and when the weather clears you remove the listener. This is a simple spell that can be cast from a command block and be broken seperately, but if you only allow only one event handler you need to write the spell completely different and can no longer cast it without using a gist."}}
{"actor":{"display_login":"Adrodoc55"}}