mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-22 02:25:38 +01:00
Add MineDown support (and with that RGB colors)
This commit is contained in:
parent
fc40436422
commit
a8db0033df
10
pom.xml
10
pom.xml
@ -50,8 +50,8 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
@ -61,6 +61,12 @@
|
||||
<version>1.0.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.themoep</groupId>
|
||||
<artifactId>minedown</artifactId>
|
||||
<version>1.6.1-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.themoep.utils</groupId>
|
||||
<artifactId>lang-bukkit</artifactId>
|
||||
|
@ -65,6 +65,10 @@
|
||||
<pattern>io.papermc.lib</pattern>
|
||||
<shadedPattern>de.themoep.randomteleport.libs.paperlib</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>de.themoep.minedown</pattern>
|
||||
<shadedPattern>de.themoep.randomteleport.libs.minedown</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>de.themoep.utils.lang</pattern>
|
||||
<shadedPattern>de.themoep.randomteleport.libs.lang</shadedPattern>
|
||||
|
@ -20,6 +20,7 @@ package de.themoep.randomteleport;
|
||||
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.Table;
|
||||
import de.themoep.minedown.MineDown;
|
||||
import de.themoep.randomteleport.api.RandomTeleportAPI;
|
||||
import de.themoep.randomteleport.hook.HookManager;
|
||||
import de.themoep.randomteleport.listeners.SignListener;
|
||||
@ -38,6 +39,8 @@ import de.themoep.randomteleport.searcher.validators.ProtectionValidator;
|
||||
import de.themoep.randomteleport.searcher.validators.WorldborderValidator;
|
||||
import de.themoep.utils.lang.bukkit.LanguageManager;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@ -276,16 +279,24 @@ public class RandomTeleport extends JavaPlugin implements RandomTeleportAPI {
|
||||
}
|
||||
|
||||
public boolean sendMessage(CommandSender sender, String key, String... replacements) {
|
||||
String message = getMessage(sender, key, replacements);
|
||||
if (message != null && !message.isEmpty()) {
|
||||
sender.sendMessage(message);
|
||||
BaseComponent[] message = getComponentMessage(sender, key, replacements);
|
||||
if (message != null && message.length != 0) {
|
||||
sender.spigot().sendMessage(message);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getMessage(CommandSender sender, String key, String... replacements) {
|
||||
return lang.getConfig(sender).get(key, replacements);
|
||||
public BaseComponent[] getComponentMessage(CommandSender sender, String key, String... replacements) {
|
||||
return MineDown.parse(getLang(sender, key), replacements);
|
||||
}
|
||||
|
||||
public String getTextMessage(CommandSender sender, String key, String... replacements) {
|
||||
return TextComponent.toLegacyText(getComponentMessage(sender, key, replacements));
|
||||
}
|
||||
|
||||
private String getLang(CommandSender sender, String key) {
|
||||
return lang.getConfig(sender).get(key);
|
||||
}
|
||||
|
||||
public HookManager getHookManager() {
|
||||
|
@ -58,7 +58,7 @@ public class SimpleOptionParser implements OptionParser {
|
||||
}
|
||||
if (aliases.contains(option)) {
|
||||
if (!hasAccess(searcher.getInitiator())) {
|
||||
throw new IllegalArgumentException(searcher.getPlugin().getMessage(
|
||||
throw new IllegalArgumentException(searcher.getPlugin().getTextMessage(
|
||||
searcher.getInitiator(), "error.no-permission.option",
|
||||
"option", option,
|
||||
"perm", "randomteleport.manual.option." + aliases.iterator().next()));
|
||||
|
Loading…
Reference in New Issue
Block a user