mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
Add MineDown support
This commit is contained in:
1 parent
1ef65accba
commit
9a91a299c4
3 files changed
+35
-7
No files matched your search
@@ -117,6 +117,12 @@
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
<!-- MineDown -->
|
||||
<repository>
|
||||
<id>minebench-repo</id>
|
||||
<url>http://repo.minebench.de/</url>
|
||||
</repository>
|
||||
|
||||
<!-- mcMMO and MiniMessage must be compiled locally -->
|
||||
|
||||
</repositories>
|
||||
@@ -165,6 +171,13 @@
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- MineDown, alternative to MiniMessage -->
|
||||
<dependency>
|
||||
<groupId>de.themoep</groupId>
|
||||
<artifactId>minedown</artifactId>
|
||||
<version>1.6.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Placeholders -->
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.draycia.simplechat;
|
||||
|
||||
import de.themoep.minedown.MineDown;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.listeners.*;
|
||||
import net.draycia.simplechat.managers.*;
|
||||
@@ -10,6 +11,7 @@ import net.draycia.simplechat.util.ItemStackUtils;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.serializer.bungeecord.BungeeCordComponentSerializer;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@@ -104,13 +106,21 @@ public final class SimpleChat extends JavaPlugin {
|
||||
}
|
||||
|
||||
public Component processMessage(String input, String... placeholders) {
|
||||
if (getConfig().getBoolean("use-markdown")) {
|
||||
return MiniMessage.markdown().parse(input, placeholders);
|
||||
} else {
|
||||
return MiniMessage.get().parse(input, placeholders);
|
||||
switch (getConfig().getString("formatting.type", "minimessage").toLowerCase()) {
|
||||
case "minedown":
|
||||
return processMineDown(input, placeholders);
|
||||
case "minimessage-markdown":
|
||||
return MiniMessage.markdown().parse(input, placeholders);
|
||||
case "minimessage":
|
||||
default:
|
||||
return MiniMessage.get().parse(input, placeholders);
|
||||
}
|
||||
}
|
||||
|
||||
private Component processMineDown(String input, String... placeholders) {
|
||||
return BungeeCordComponentSerializer.get().deserialize(MineDown.parse(input, placeholders));
|
||||
}
|
||||
|
||||
public ChatChannel getDefaultChannel() {
|
||||
for (ChatChannel channel : channels) {
|
||||
if (channel.isDefault()) {
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# MiniMessage Docs:
|
||||
# https://github.com/KyoriPowered/adventure-docs/blob/feature/minimessage/source/minimessage.rst#the-components
|
||||
|
||||
# SimpleChat Docs:
|
||||
# https://github.com/Draycia/Chat/wiki
|
||||
|
||||
@@ -57,6 +54,14 @@ replacements:
|
||||
# https://github.com/KyoriPowered/adventure-docs/blob/feature/minimessage/source/minimessage.rst#markdown
|
||||
use-markdown: false
|
||||
|
||||
# Options:
|
||||
# 'MiniMessage': https://github.com/KyoriPowered/adventure-docs/blob/feature/minimessage/source/minimessage.rst#the-components
|
||||
# 'MiniMessage-Markdown': https://github.com/KyoriPowered/adventure-docs/blob/feature/minimessage/source/minimessage.rst#markdown
|
||||
# 'MineDown': https://github.com/Phoenix616/MineDown#syntax
|
||||
# Note that the messages provided in the default config utilise MiniMessage, and need to be changed if you're using MineDown
|
||||
formatting:
|
||||
type: 'MiniMessage'
|
||||
|
||||
language:
|
||||
ignoring-user: '<green>You are now ignoring <gold><player><green>!'
|
||||
not-ignoring-user: '<green>You are no longer ignoring <gold><player><green>!'
|
||||
|
||||
Reference in new issue
Block a user