Skip to content

Commit

Permalink
Merge pull request jkvn#3 from swnck/main
Browse files Browse the repository at this point in the history
Changed README.md added priorities example methods and added license part
  • Loading branch information
swnck authored Feb 26, 2024
2 parents 35f8bca + 7ca1ff2 commit 0cc76ea
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
## ⚠️ UNDER DEVELOPMENT ⚠️

Welcome to EventLib, your user-friendly Java event library using sockets for seamless communication between various applications.

## **Quick Start** 🚀

### Maven
Expand Down Expand Up @@ -41,7 +40,7 @@ Then, include the dependency:
```groovy
implementation("at.jkvn.eventlib:EventLib:LATEST")
```

---
## Integration 🛠️

Integrating EventLib into your project is straightforward:
Expand Down Expand Up @@ -97,9 +96,12 @@ class StartupEvent extends Event {}
```java
EventLib.call(new StartupEvent());
```
---
## Extras & Features 🎉

## Priorities

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

- `EventPriority.LOWEST`
Expand All @@ -108,8 +110,27 @@ EventLib supports the following event priorities:
- `EventPriority.HIGH`
- `EventPriority.HIGHEST`

## Extras & Features
````java
@EventHandler
@Priority(EventPriority.HIGHEST)
public void onListenYourFavoriteEvent(YourFavoriteEvent event) {
System.out.print("This event is executed first");
}

@EventHandler
@Priority(EventPriority.HIGH)
public void onListenYourFavoriteEvent(YourFavoriteEvent event) {
System.out.print("This event is executed after the HIGHEST event");
}

@EventHandler
@Priority(EventPriority.NORMAL)
public void onListenYourFavoriteEvent(YourFavoriteEvent event) {
System.out.print("This event is executed after the HIGH event");
}
````
---
### Cancellation
EventLib provides additional features such as event cancellation and resumption:

```java
Expand Down Expand Up @@ -140,6 +161,7 @@ public void onListenYourFavoriteEvent(YourFavoriteEvent event) {
}
```


## Future Plans 🛌

- [ ] Asynchronous events
Expand All @@ -149,3 +171,6 @@ public void onListenYourFavoriteEvent(YourFavoriteEvent event) {
- [x] Event listener priority
- [ ] Socket connection
- [ ] Socket authentication (password, private key, etc.)

## License 📜
The contents of this repository are licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

0 comments on commit 0cc76ea

Please sign in to comment.