Skip to content

Commit 5c8f327

Browse files
committed
Update README
1 parent 00feab9 commit 5c8f327

File tree

2 files changed

+123
-30
lines changed

2 files changed

+123
-30
lines changed

README.md

Lines changed: 122 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<div align="center">
22

33
![](/assets/readme-banner.png)
4-
# Supports cdn and okaeri configs
4+
# Multification
5+
#### Powerful library for sending custom notifications based on adventure.
56

67
[![Patreon](https://raw.githubusercontent.com/intergrav/devins-badges/v3/assets/cozy/donate/patreon-plural_vector.svg)](https://www.patreon.com/eternalcode)
78
[![Website](https://raw.githubusercontent.com/intergrav/devins-badges/v3/assets/cozy/documentation/website_vector.svg)](https://eternalcode.pl/)
@@ -12,32 +13,40 @@
1213

1314
</div>
1415

15-
# Introduction
16+
# About Multification
1617

17-
Multification is a spigot-based library that allows you to easily create configurable notifications and messages inside your plugin.
18-
The library supports sending notifications via one or multiple options:
19-
- Customizable messages,
20-
- Action bar notifications,
21-
- Title and subtitle,
22-
- Bossbar notifications,
23-
- and sounds,
18+
Multification allows you to easily create configurable notifications and messages inside your plugin.
19+
The library provides a lot of features such as:
2420

25-
messages can be sent to:
26-
- Multiple players,
27-
- One player,
28-
- Console
21+
- 💭 Chat messages
22+
- 📕 Title & Subtitle
23+
- 🎬 ActionBar
24+
- 🍫 BossBar
25+
- 🔊 Sounds
26+
- 🎨 Adventure support
27+
- 🌈 MiniMessage support (including gradients, hex colors, hover, click and more)
28+
- 📥 Placeholders
29+
- 🛠️ Formatter support
30+
- 🌎 Flexible messages providing (easy to implement i18n)
31+
- 📦 Configuration support (CDN, Okaeri Configs)
32+
- Cross-platform support (currently we support Bukkit, but it's easy to add support for other adventure-based platforms)
2933

30-
Your messages can also contain placeholders :P
34+
Messages can be sent to any audience, such as players or the console.
3135

32-
## Setup
36+
## Getting Started
3337

3438
To use the library, you need to add the following repository and dependency to your `build.gradle` file:
3539

36-
```gradle
40+
```kts
41+
maven("https://repo.eternalcode.pl/releases")
42+
```
43+
44+
```kts
3745
implementation("com.eternalcode:multification-bukkit:1.1.4")
38-
implementation("com.eternalcode:multification-cdn:1.1.4")
3946
```
4047

48+
> **Note:** If you want to use the library with other platforms, then you need to use the `multification-core` dependency.
49+
4150
Then create a new instance of the `Multification` class and use it to send notifications:
4251

4352
```java
@@ -77,25 +86,109 @@ public class YourMultification extends BukkitMultification<MessagesConfig> {
7786
}
7887
```
7988

80-
Then on enable, you can create a new instance of the `YourMultification` class and use it to send notifications:
89+
Then in init method such as `onEnable`,
90+
you can create a new instance of the `YourMultification` class and use it to send notifications:
8191

8292
```java
83-
private AudienceProvider audienceProvider = BukkitAudiences.create(this);
84-
MiniMessage miniMessage = MiniMessage.miniMessage();
85-
86-
MessagesConfig messagesConfig = new MessagesConfig();
87-
YourMultification multification = new YourMultification(messagesConfig, audienceProvider, miniMessage);
93+
AudienceProvider audienceProvider = BukkitAudiences.create(this);
94+
MiniMessage miniMessage = MiniMessage.miniMessage();
95+
96+
MessagesConfig messagesConfig = new MessagesConfig();
97+
YourMultification multification = new YourMultification(messagesConfig, audienceProvider, miniMessage);
8898
```
8999

90100
After that, you can use the `multification` instance to send notifications:
91101

92102
```java
93-
multification.create()
94-
.player(player.getUniqueId())
95-
.notice(messages -> messages.yourMessage)
96-
.send();
103+
multification.create()
104+
.player(player.getUniqueId())
105+
.notice(messages -> messages.yourMessage)
106+
.send();
107+
```
108+
109+
## Configuration Support
110+
111+
Multification currently supports two configuration libraries:
112+
- [CDN](https://github.com/dzikoysk/cdn) _Simple and fast property-based configuration library for JVM apps_
113+
- [Okaeri Configs](https://github.com/OkaeriPoland/okaeri-configs) _Simple Java/POJO config library written with love and Lombok_
114+
115+
To use the Multification library with one of the configuration libraries, you need to:
116+
117+
### [CDN](https://github.com/dzikoysk/cdn)
118+
119+
#### (CDN) 1. Add dependency to your `build.gradle` file:
120+
```gradle
121+
implementation("com.eternalcode:multification-cdn:1.1.4")
122+
implementation("net.dzikoysk:cdn:1.14.5")
123+
```
124+
125+
#### (CDN) 2. Create configuration class:
126+
```java
127+
public class MessagesConfig {
128+
@Description("# My first message")
129+
public Notice firstMessage = Notice.chat("<gradient:red:blue>Multification is awesome!");
130+
}
97131
```
98132

99-
Setting up configuration is easy both in cdn and Okaeri Configs. To add messages to the configuration, create variable in config with class `Notice` or `BukkitNotice`. You can also use builder. After plugin deploy you can find messages in configuration file.
133+
#### (CDN) 3. Create a new instance of the `Cdn` with the `MultificationNoticeCdnComposer`:
134+
```java
135+
Cdn cdn = CdnFactory.createYamlLike()
136+
.getSettings()
137+
.withComposer(Notice.class, new MultificationNoticeCdnComposer(multification.getNoticeRegistry()))
138+
.build();
139+
```
140+
141+
#### (CDN) 4. Load the configuration:
142+
143+
To load and create the config file, use the following code in the init method such as `onEnable`:
144+
145+
```java
146+
MessagesConfig messages = new MessagesConfig();
147+
Resource resource = Source.of(this.dataFolder, "messages.yml");
148+
149+
cdn.load(resource, messages)
150+
.orThrow(cause -> cause);
151+
152+
cdn.render(config, resource)
153+
.orThrow(cause -> cause);
154+
```
155+
156+
Checkout example with CDN! [example plugin](https://github.com/EternalCodeTeam/multification/tree/master/examples/bukkit).
157+
158+
### [Okaeri Configs](https://github.com/OkaeriPoland/okaeri-configs)
159+
160+
#### (Okaeri) 1. Add the following dependency to your `build.gradle` file:
161+
162+
```gradle
163+
implementation("com.eternalcode:multification-okaeri:1.1.4")
164+
```
165+
166+
Probably also you will need to add additional dependencies for your platform, e.g. :
167+
```gradle
168+
implementation("eu.okaeri:okaeri-configs-serdes-commons:5.0.5")
169+
implementation("eu.okaeri:okaeri-configs-serdes-bukkit:5.0.5")
170+
implementation("eu.okaeri:okaeri-configs-yaml-bukkit:5.0.5")
171+
```
172+
See [Okaeri Configs](https://github.com/OkaeriPoland/okaeri-configs) for more information.
173+
174+
#### (Okaeri) 2. Create configuration class:
175+
176+
```java
177+
public class MessagesConfig extends OkaeriConfig {
178+
@Comment("My first message")
179+
public Notice firstMessage = Notice.chat("<gradient:red:blue>Multification is awesome!");
180+
}
181+
```
182+
183+
#### (Okaeri) 3. Load the configuration:
184+
185+
```java
186+
MessagesConfig config = (MessagesConfig) ConfigManager.create(MessagesConfig.class)
187+
.withConfigurer(new MultificationSerdesPack(multification.getNoticeRegistry()))
188+
.withConfigurer(new SerdesCommons(), new YamlBukkitConfigurer(), new SerdesBukkit()) // specify configurers for your platform
189+
.withBindFile(new File(dataFolder, "messages.yml"))
190+
.withRemoveOrphans(true) // automatic removal of undeclared keys
191+
.saveDefaults() // save file if does not exists
192+
.load(true);
193+
```
100194

101-
### To see more examples open the [example plugin module](https://github.com/EternalCodeTeam/multification/tree/master/examples/bukkit).

examples/bukkit/src/main/java/com/eternalcode/example/bukkit/config/MessagesConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class MessagesConfig {
2222
public Notice senderGiveCommandMessage = Notice.title("<green>You have given <yellow>{amount}x {item}</yellow> to <yellow>{player}</yellow>.");
2323
public Notice receiverGiveCommandMessage = BukkitNotice.builder()
2424
.title("<green>You have received <yellow>{amount}x {item}</yellow> from <yellow>{player}</yellow>.")
25-
.subtitle("<pride:gay>Remember to say thank you!</pride>")
25+
.subtitle("<pride:pride>Remember to say thank you!</pride>")
2626
.sound(Sound.ENTITY_ITEM_PICKUP)
2727
.build();
2828

0 commit comments

Comments
 (0)