tutorial:events
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
tutorial:events [2019/07/03 00:29] – added javadoc description draylar | tutorial:events [2019/07/03 00:31] – tell people to return PASS in listeners draylar | ||
---|---|---|---|
Line 9: | Line 9: | ||
==== Creating a Callback Interface ==== | ==== Creating a Callback Interface ==== | ||
- | The callback interface is the core of your event. It stores a list of all registered listeners (which are like responses to an event), and calls them all when the action occurs. Each listener can then say " | + | The callback interface is the core of your event. It stores a list of all registered listeners (which are like responses to an event) and calls them all when the action occurs. Each listener can then say " |
You'll need to create an interface that has an '' | You'll need to create an interface that has an '' | ||
Line 96: | Line 96: | ||
}); | }); | ||
</ | </ | ||
- | Note that this event also sets the sheep to be sheared manually, as it is normally canceled if we return FAIL. | + | Note that this event also sets the sheep to be sheared manually, as it is normally canceled if we return FAIL. If you don't //need// to cancel the event, make sure you return '' |
If you enter into your game and shear a sheep, a diamond should drop instead of wool. | If you enter into your game and shear a sheep, a diamond should drop instead of wool. | ||
{{https:// | {{https:// |
tutorial/events.txt · Last modified: 2021/05/28 00:31 by 127.0.0.1