Skip to content

Commit 96b6bff

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 1148dbb + 74cf001 commit 96b6bff

File tree

2 files changed

+85
-3
lines changed

2 files changed

+85
-3
lines changed

.github/workflows/gradle-publish.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
name: Gradle Package
99

10-
on: [push]
10+
on:
11+
release:
12+
types: [created]
1113

1214
jobs:
1315
build:

README.md

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,96 @@
44

55
*This plugin has been made in about 4 days as a test for Rivrs.*
66

7-
ToastNotifier is a plugin that allow to send [toast like notification](https://en.wikipedia.org/wiki/Pop-up_notification) to a player screen. This notification can have a title and 2 rows of text as well as an image !
7+
ToastNotifier is a plugin that allow to send [toast like notification](https://en.wikipedia.org/wiki/Pop-up_notification) to a player screen. This notification can have a title and 2 rows of text, as well as an image !
88

99
Example :
1010

1111
![image](https://github.com/vadim-soude/ToastNotifier/assets/94833069/4922b757-e5e4-4b1e-a699-67ed4a61ba6b)
1212

1313
## Using it
1414

15-
You can send these notifications using the custom command provided by the plugin (see below for help).
15+
You can send these notifications [using the custom command provided by the plugin](https://github.com/vadim-soude/ToastNotifier?tab=readme-ov-file#The-command-approche), or [using your own plugin with this one as a dependancy](https://github.com/vadim-soude/ToastNotifier?tab=readme-ov-file#The-plugin-approche).
1616

1717
The plugin include a queue system for the notifications, allowing you to send notification to the player and being sure that each of the notifications are display as intended and in the order in which you sent them on the player screen !
1818

1919
This plugin is based around vanilla features, mainly fonts and core shaders, so you will need the resource pack provided with the plugin [See the releases](https://github.com/vadim-soude/ToastNotifier/releases/).
20+
21+
## The command approach
22+
23+
You can send a notification from the built-in command using this simple syntax :
24+
```
25+
/notif <target> <image> {"title":"Your title","first-row":"Your first line","second-row":"Your second line"}
26+
```
27+
The ``<target>`` being the player that will receive the notification and the ``<image>`` being one of the images specified in the config (both of these parameters have auto-completion and suggestion).
28+
29+
## The plugin approach
30+
*This part while be dedicated to Gradle only*
31+
32+
Once your Gradle project is set up, you are going to edit a couple of file :
33+
34+
### gradle.build
35+
36+
Add the repository :
37+
```diff
38+
repositories {
39+
...
40+
+ maven {
41+
+ url = uri("https://maven.pkg.github.com/vadim-soude/toastnotifier")
42+
+ credentials {
43+
+ username = findProperty("github.username")
44+
+ password = findProperty("github.token")
45+
+ }
46+
+ }
47+
...
48+
}
49+
```
50+
Add the dependency :
51+
```diff
52+
dependencies {
53+
...
54+
+ implementation 'fr.vadimsoude:toastnotifier:1.3'
55+
...
56+
}
57+
```
58+
### gradle.properties
59+
60+
Add your GitHub credentials :
61+
```diff
62+
+ github.username=your-github-username-in-lower-case
63+
+ github.token=xxxxxxxxxxxxxxx
64+
```
65+
Get a token here : https://github.com/settings/tokens (You don't need to add any particular permission to it, only for authentication with GitHub Packages)
66+
67+
**DO NOT SHARE YOUR TOKEN AND DON'T PUSH IT TO ANY GIT REPO, BE CAREFUL !**
68+
69+
### plugin.yml
70+
Add the depend mention :
71+
```diff
72+
+ depend: [ToastNotifier]
73+
```
74+
75+
Add the .jar of the corresponding version of ToastNotifier in the plugin directory of your server (You can found the .jar in the packages section of this repo)
76+
77+
And now everything should work (open an issue if you encounter any problem) you can now use the API to send a notification.
78+
79+
## Plugin Example
80+
81+
To send a notification you need to provide the target, the image name as defined in the config.yml of ToastNotifier, the title text, the first row text and the second row text.
82+
83+
Then, you need to use the ``.send()`` method to send the notification to the player (the notification will end-up in the queue if another notification is currently displayed).
84+
85+
#### Example of a notification sent to any player that join the server :
86+
87+
```Java
88+
public class ListenerExample implements Listener {
89+
@EventHandler
90+
public void onJoinEvent(PlayerJoinEvent event) {
91+
Notification notification = new Notification(event.getPlayer(), "purple", "Welcome !", "have fun in this", "server .");
92+
notification.send();
93+
}
94+
}
95+
```
96+
97+
# Have fun !
98+
99+
*Readme updated for version 1.3*

0 commit comments

Comments
 (0)