Skip to content

Commit 4d40429

Browse files
committed
messages config
1 parent b0618e9 commit 4d40429

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

src/main/java/pro/cloudnode/smp/cloudnodemsg/PluginConfig.java

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,63 @@ public PluginConfig(final @NotNull FileConfiguration config) {
8383
);
8484
}
8585

86+
/**
87+
* Message channel created
88+
* <p>Placeholders:</p>
89+
* <ul>
90+
* <li>{@code <sender>} - the username of the message sender</li>
91+
* <li>{@code <recipient>} - the username of the message recipient</li>
92+
* <li>{@code <command>} - the command used, e.g. `msg`, `dm`, etc.</li>
93+
* </ul>
94+
*
95+
* @param sender The username of the message sender
96+
* @param recipient The username of the message recipient
97+
* @param command The command used, e.g. `msg`, `dm`, etc.
98+
*/
99+
public @NotNull Component channelCreated(final @NotNull String sender, final @NotNull String recipient, final @NotNull String command) {
100+
return MiniMessage.miniMessage().deserialize(Objects.requireNonNull(config.getString("channel.created"))
101+
.replace("<sender>", sender)
102+
.replace("<recipient>", recipient)
103+
.replace("<command>", command));
104+
}
105+
106+
/**
107+
* Message channel closed
108+
* <p>Placeholders:</p>
109+
* <ul>
110+
* <li>{@code <sender>} - the username of the message sender</li>
111+
* <li>{@code <recipient>} - the username of the message recipient</li>
112+
* <li>{@code <command>} - the command used, e.g. `msg`, `dm`, etc.</li>
113+
* </ul>
114+
*
115+
* @param sender The username of the message sender
116+
* @param recipient The username of the message recipient
117+
* @param command The command used, e.g. `msg`, `dm`, etc.
118+
*/
119+
public @NotNull Component channelClosed(final @NotNull String sender, final @NotNull String recipient, final @NotNull String command) {
120+
return MiniMessage.miniMessage().deserialize(Objects.requireNonNull(config.getString("channel.closed"))
121+
.replace("<sender>", sender)
122+
.replace("<recipient>", recipient)
123+
.replace("<command>", command));
124+
}
125+
126+
/**
127+
* Message channel player is offline and channel closed
128+
* <p>Placeholders:</p>
129+
* <ul>
130+
* <li>{@code <sender>} - the username of the message sender</li>
131+
* <li>{@code <recipient>} - the username of the message recipient</li>
132+
* </ul>
133+
*
134+
* @param sender The username of the message sender
135+
* @param recipient The username of the message recipient
136+
*/
137+
public @NotNull Component channelOffline(final @NotNull String sender, final @NotNull String recipient) {
138+
return MiniMessage.miniMessage().deserialize(Objects.requireNonNull(config.getString("channel.offline"))
139+
.replace("<sender>", sender)
140+
.replace("<recipient>", recipient));
141+
}
142+
86143
/**
87144
* Command usage format
88145
* <p>Placeholders:</p>

src/main/resources/config.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ ignored: "<green>(!) You will no longer see messages from <gray><player></gray>.
1818
# Same placeholders as ignored
1919
unignored: "<yellow>(!) You are no longer ignoring <gray><player></gray>.</yellow>"
2020

21+
channel:
22+
# Message channel created
23+
# Placeholders:
24+
# <sender> - the username of the message sender
25+
# <recipient> - the username of the message recipient
26+
# <command> - the command used, e.g. `msg`, `dm`, etc.
27+
created: <green>(!) Your chat messages will now be sent as private messages to <gray><recipient></gray>. To re-enable public messages, run <click:suggest_command:/<command> <recipient>><gray>/<command> <recipient></gray></click></green>
28+
29+
# Message channel closed
30+
# Same placeholders as created
31+
closed: <yellow>(!) Your chat messages will now be <gray>public</gray>.</yellow>
32+
33+
# Message channel player is offline and channel closed
34+
# Same placeholders as created
35+
offline: <red>(!) Player <gray><player></gray> is offline. Your chat messages have been switched back to <gray>public</gray>.</red>
36+
2137
# Name for console/server that should appear as <sender> or <recipient> in messages
2238
console-name: "Server"
2339

0 commit comments

Comments
 (0)