Skip to content

Commit 0cc76ea

Browse files
authored
Merge pull request jkvn#3 from swnck/main
Changed README.md added priorities example methods and added license part
2 parents 35f8bca + 7ca1ff2 commit 0cc76ea

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

Diff for: README.md

+30-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
## ⚠️ UNDER DEVELOPMENT ⚠️
33

44
Welcome to EventLib, your user-friendly Java event library using sockets for seamless communication between various applications.
5-
65
## **Quick Start** 🚀
76

87
### Maven
@@ -41,7 +40,7 @@ Then, include the dependency:
4140
```groovy
4241
implementation("at.jkvn.eventlib:EventLib:LATEST")
4342
```
44-
43+
---
4544
## Integration 🛠️
4645

4746
Integrating EventLib into your project is straightforward:
@@ -97,9 +96,12 @@ class StartupEvent extends Event {}
9796
```java
9897
EventLib.call(new StartupEvent());
9998
```
99+
---
100+
## Extras & Features 🎉
100101

101-
## Priorities
102-
102+
### Priorities
103+
You can set the priority of an event with our built-in @Priority annotation.
104+
This tells you that the event with the HIGHEST priority is executed first and then the next and the next
103105
EventLib supports the following event priorities:
104106

105107
- `EventPriority.LOWEST`
@@ -108,8 +110,27 @@ EventLib supports the following event priorities:
108110
- `EventPriority.HIGH`
109111
- `EventPriority.HIGHEST`
110112

111-
## Extras & Features
113+
````java
114+
@EventHandler
115+
@Priority(EventPriority.HIGHEST)
116+
public void onListenYourFavoriteEvent(YourFavoriteEvent event) {
117+
System.out.print("This event is executed first");
118+
}
112119

120+
@EventHandler
121+
@Priority(EventPriority.HIGH)
122+
public void onListenYourFavoriteEvent(YourFavoriteEvent event) {
123+
System.out.print("This event is executed after the HIGHEST event");
124+
}
125+
126+
@EventHandler
127+
@Priority(EventPriority.NORMAL)
128+
public void onListenYourFavoriteEvent(YourFavoriteEvent event) {
129+
System.out.print("This event is executed after the HIGH event");
130+
}
131+
````
132+
---
133+
### Cancellation
113134
EventLib provides additional features such as event cancellation and resumption:
114135

115136
```java
@@ -140,6 +161,7 @@ public void onListenYourFavoriteEvent(YourFavoriteEvent event) {
140161
}
141162
```
142163

164+
143165
## Future Plans 🛌
144166

145167
- [ ] Asynchronous events
@@ -149,3 +171,6 @@ public void onListenYourFavoriteEvent(YourFavoriteEvent event) {
149171
- [x] Event listener priority
150172
- [ ] Socket connection
151173
- [ ] Socket authentication (password, private key, etc.)
174+
175+
## License 📜
176+
The contents of this repository are licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

0 commit comments

Comments
 (0)