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