mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 06:28:49 +00:00
Adjusted MineDown options
This commit is contained in:
1 parent
54ce1c0e72
commit
594db59a77
2 files changed
+32
-10
No files matched your search
@@ -45,6 +45,22 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>8</source>
|
||||||
|
<detectJavaApiLink>false</detectJavaApiLink>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package me.william278.huskhomes2;
|
package me.william278.huskhomes2;
|
||||||
|
|
||||||
import de.themoep.minedown.MineDown;
|
import de.themoep.minedown.MineDown;
|
||||||
|
import de.themoep.minedown.MineDownParser;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
|
||||||
import org.apache.commons.lang.StringEscapeUtils;
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@@ -102,6 +103,12 @@ public class messageManager {
|
|||||||
// Send a message to the correct channel
|
// Send a message to the correct channel
|
||||||
private static void sendMessage(Player p, ChatMessageType chatMessageType, String messageID, String... placeholderReplacements) {
|
private static void sendMessage(Player p, ChatMessageType chatMessageType, String messageID, String... placeholderReplacements) {
|
||||||
String message = getRawMessage(messageID);
|
String message = getRawMessage(messageID);
|
||||||
|
|
||||||
|
// Don't send empty messages
|
||||||
|
if (StringUtils.isEmpty(message)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int replacementIndexer = 1;
|
int replacementIndexer = 1;
|
||||||
|
|
||||||
// Replace placeholders
|
// Replace placeholders
|
||||||
@@ -111,22 +118,21 @@ public class messageManager {
|
|||||||
replacementIndexer = replacementIndexer + 1;
|
replacementIndexer = replacementIndexer + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get formatted base components from MineDown
|
// Convert to baseComponents[] via MineDown formatting and send
|
||||||
BaseComponent[] components = new MineDown(message).toComponent();
|
p.spigot().sendMessage(chatMessageType, new MineDown(message).enable(MineDownParser.Option.ADVANCED_FORMATTING).enable(MineDownParser.Option.SIMPLE_FORMATTING).toComponent());
|
||||||
|
|
||||||
// Convert to text component and send
|
|
||||||
p.spigot().sendMessage(chatMessageType, components);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a message with no placeholder parameters
|
// Send a message with no placeholder parameters
|
||||||
public static void sendMessage(Player p, String messageID) {
|
public static void sendMessage(Player p, String messageID) {
|
||||||
String message = getRawMessage(messageID);
|
String message = getRawMessage(messageID);
|
||||||
|
|
||||||
// Get formatted base components from MineDown
|
// Don't send empty messages
|
||||||
BaseComponent[] components = new MineDown(message).toComponent();
|
if (StringUtils.isEmpty(message)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Convert to text component and send
|
// Convert to baseComponents[] via MineDown formatting and send
|
||||||
p.spigot().sendMessage(components);
|
p.spigot().sendMessage(new MineDown(message).enable(MineDownParser.Option.ADVANCED_FORMATTING).enable(MineDownParser.Option.SIMPLE_FORMATTING).toComponent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getRawMessage(String messageID) {
|
public static String getRawMessage(String messageID) {
|
||||||
|
|||||||
Reference in new issue
Block a user